Skip to content

Commit a062f64

Browse files
authored
#31 - Adds support for laravel mix 6 (#33)
* #31 - adds support for laravel mix 6 * fix tests
1 parent 133bacf commit a062f64

File tree

8 files changed

+19
-11
lines changed

8 files changed

+19
-11
lines changed

src/Command/AssetMixCommand.php

+2
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ private function updateVuePackagesArray($packages)
298298
'sass' => '^1.20.1',
299299
'sass-loader' => '^8.0.0',
300300
'vue' => '^2.5.18',
301+
'vue-loader' => '^15.9.8',
301302
'vue-template-compiler' => '^2.6.10',
302303
] + $packages;
303304
}
@@ -357,6 +358,7 @@ private function updateInertiavuePackagesArray($packages)
357358
'portal-vue' => '^1.5.1',
358359
'vue' => '^2.6.11',
359360
'vue-meta' => '^2.3.1',
361+
'vue-loader' => '^15.9.8',
360362
'vue-template-compiler' => '^2.6.11',
361363
'bootstrap' => '^4.0.0',
362364
] + $packages;

src/StubsPathTrait.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public function getInertiaReactPackageJsonPath(): array
149149
*/
150150
public function getVueWebpackMixJsPath(): array
151151
{
152-
$webpackConfigPath = $this->getBaseCommonStubsPath() . 'webpack.mix.js';
152+
$webpackConfigPath = $this->getBaseVueStubsPath() . 'webpack.mix.js';
153153

154154
return [
155155
'from' => $webpackConfigPath,

stubs/common/package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
"private": true,
33
"scripts": {
44
"dev": "npm run development",
5-
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
6-
"watch": "npm run development -- --watch",
7-
"watch-poll": "npm run watch -- --watch-poll",
8-
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --disable-host-check --config=node_modules/laravel-mix/setup/webpack.config.js",
5+
"development": "mix",
6+
"watch": "mix watch",
7+
"watch-poll": "mix watch -- --watch-options-poll=1000",
8+
"hot": "mix watch --hot",
99
"prod": "npm run production",
10-
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
10+
"production": "mix --production"
1111
},
1212
"devDependencies": {
1313
"axios": "^0.19",
1414
"cross-env": "^7.0",
15-
"laravel-mix": "^5.0.1",
15+
"laravel-mix": "^6.0.34",
1616
"lodash": "^4.17.19",
1717
"resolve-url-loader": "^3.1.0",
1818
"sass": "^1.15.2",

stubs/inertia-react/webpack.mix.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const mix = require('laravel-mix');
22

33
mix.setPublicPath('./webroot')
4-
.react('assets/js/app.js', 'webroot/js')
4+
.js('assets/js/app.js', 'webroot/js').react()
55
.sass('assets/sass/app.scss', 'webroot/css')
66
.webpackConfig({
77
output: {

stubs/inertia-vue/webpack.mix.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const mix = require('laravel-mix');
22
const path = require('path');
33

44
mix.setPublicPath('./webroot')
5-
.js('assets/js/app.js', 'webroot/js')
5+
.js('assets/js/app.js', 'webroot/js').vue()
66
.sass('assets/sass/app.scss', 'webroot/css')
77
.webpackConfig({
88
output: {

stubs/react/webpack.mix.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const mix = require('laravel-mix');
22

33
mix.setPublicPath('./webroot')
4-
.react('assets/js/app.js', 'webroot/js')
4+
.js('assets/js/app.js', 'webroot/js').react()
55
.sass('assets/sass/app.scss', 'webroot/css')
66
.version();

stubs/vue/webpack.mix.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const mix = require('laravel-mix');
2+
3+
mix.setPublicPath('./webroot')
4+
.js('assets/js/app.js', 'webroot/js').vue()
5+
.sass('assets/sass/app.scss', 'webroot/css')
6+
.version();

tests/TestCase/Command/AssetMixCommandTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public function testGenerateCommandCreatesReactScaffolding()
177177
"@import '~bootstrap/scss/bootstrap';",
178178
file_get_contents($directoryPaths['to_assets_sass_app'])
179179
);
180-
$this->assertStringContainsString(".react('assets/js/app.js', 'webroot/js')", $webpackMixJsContents);
180+
$this->assertStringContainsString(".js('assets/js/app.js', 'webroot/js').react()", $webpackMixJsContents);
181181
}
182182

183183
public function testGenerateCommandCreatesInertiaVueScaffolding()

0 commit comments

Comments
 (0)