-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.mix.js
56 lines (53 loc) · 1.67 KB
/
webpack.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* eslint import/no-extraneous-dependencies: ["off"] */
const path = require('path');
const { mix } = require('laravel-mix');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
/*
|--------------------------------------------------------------------------
| 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/blog/blog.js', 'js/')
.js('resources/assets/js/admin/admin.js', 'js/')
.sass('resources/assets/sass/blog/blog.scss', 'css/')
.sass('resources/assets/sass/admin/admin.scss', 'css/')
.extract([
'vue',
'axios',
'lodash',
'v-tooltip',
'js-cookie',
'element-ui',
'vue-router',
'speakingurl',
'vue-lazyload',
'vue-infinite-loading',
'./resources/assets/js/bootstrap',
])
.sourceMaps()
.setResourceRoot()
.webpackConfig({
output: {
path: path.resolve(Mix.isUsing('hmr') ? '/' : 'public/'),
filename: '[name].js',
chunkFilename: 'dist/js/chunks/[name].js?id=[chunkhash]',
publicPath: Mix.isUsing('hmr') ? ('http://localhost:8080/') : '/',
},
resolve: {
alias: {
styles: path.resolve(__dirname, 'resources/assets/sass'),
app: path.resolve(__dirname, 'resources/assets/js'),
},
},
plugins: mix.inProduction() ? [
new BundleAnalyzerPlugin({ analyzerMode: 'static' }),
] : [],
});
if (mix.inProduction()) {
mix.version();
}