Laravel5.1执行gulp报
Cannot read property 'mergeConfig' of undefined
错误
Elixir.webpack.mergeConfig({
^
TypeError: Cannot read property 'mergeConfig' of undefined
at mix (/home/lethe/work/nxncl/pelissa/gulpfile.js:19:19)
at global.Elixir (/home/lethe/work/nxncl/pelissa/node_modules/.6.0.0-15@laravel-elixir/dist/index.js:21:5)
at Object.<anonymous> (/home/lethe/work/nxncl/pelissa/gulpfile.js:16:1)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
const elixir = require('laravel-elixir');
const path = require('path');
require('laravel-elixir-vue-2');
elixir(mix => {
// Elixir.webpack.config.module.loaders = [];
Elixir.webpack.mergeConfig({
resolveLoader: {
root: path.join(__dirname, 'node_modules'),
},
module: {
loaders: [
{
test: /\.css$/,
loader: 'style!css'
}
]
}
});
mix.sass('app.scss')
.webpack('app.js');
});
const { mix } = require('laravel-mix');
mix.webpackConfig({
module: {
rules: [
{
test: /\.css$/,
loader: "style-loader!css-loader"
},
]
}
});
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
mix.js('resources/assets/js/app.js', 'public/crm/js')
.sass('resources/assets/sass/app.scss', 'public/crm/css');
{
"private": true,
"scripts": {
"dev": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"hot": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"production": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.15.2",
"babel-core": "^6.17.0",
"babel-loader": "^6.2.5",
"bootstrap-sass": "^3.3.7",
"css-loader": "^0.25.0",
"element-ui": "^1.0.0",
"gulp": "^3.9.1",
"jquery": "^3.1.0",
"laravel-elixir": "^6.0.0-15",
"laravel-elixir-vue-2": "^0.3.0",
"laravel-elixir-webpack-official": "^1.0.10",
"laravel-mix": "^0.5.16",
"lodash": "^4.16.2",
"style-loader": "^0.13.1",
"vue": "^2.0.5",
"vue-loader": "^9.8.0",
"vue-resource": "^1.0.3"
}
}