forked from maingocthanhtan96/LaraJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack-js.mix.js
38 lines (34 loc) · 1.06 KB
/
webpack-js.mix.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const mix = require('laravel-mix');
const config = require('./webpack.config');
const path = require('path');
const isProduction = mix.inProduction();
require('laravel-mix-merge-manifest');
function resolve(dir) {
return path.join(__dirname, '/resources/js', dir);
}
// eslint-disable-next-line no-undef
Mix.listen('configReady', webpackConfig => {
// Add "svg" to image loader test
const imageLoaderConfig = webpackConfig.module.rules.find(
rule => String(rule.test) === String(/(\.(png|jpe?g|gif|webp)$|^((?!font).)*\.svg$)/)
);
imageLoaderConfig.exclude = resolve('icons');
});
mix
.js('resources/js/app.js', 'public/js')
.extract(['vue', 'vuex', 'vue-router', 'vue-i18n', 'axios', 'element-ui', 'nprogress'])
.webpackConfig(config)
.mergeManifest()
.vue({ version: 2 });
if (isProduction) {
mix.version();
} else {
// Development settings
// mix.browserSync({
// proxy: process.env.APP_URL,
// files: ['resources/js/**/*'],
// });
mix.sourceMaps().webpackConfig({
devtool: 'eval-cheap-source-map', // Fastest for development
});
}