This repository was archived by the owner on Jun 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.mix.js
More file actions
60 lines (58 loc) · 1.61 KB
/
webpack.mix.js
File metadata and controls
60 lines (58 loc) · 1.61 KB
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
57
58
59
60
const mix = require('laravel-mix');
const ImageminPlugin = require('imagemin-webpack-plugin').default;
const WorkboxPlugin = require('workbox-webpack-plugin');
const DIST_DIR = './public/'
mix.js('resources/assets/js/app.js', 'public/js')
.extract([
'vue',
'vuex',
'axios',
'vue-router',
'vee-validate',
'vue-js-modal',
'crypto-js/aes',
'crypto-js/enc-latin1'
])
.sass('resources/assets/sass/app.scss', 'public/css/')
.options({
postCss: [
require('cssnano')({
discardComments: {
removeAll: true,
},
}),
require('postcss-unprefix'),
require('autoprefixer')({
browsers: '>0.1%'
}),
]
})
.copy(['resources/assets/img'], 'public/images', false)
.copy(['resources/assets/img/avatar'], 'public/images/avatar', false)
.copy(['resources/assets/manifest.json'], 'public/', false)
mix.webpackConfig({
output: {
publicPath: '',
// chunkFilename: 'js/[name].js',
chunkFilename: `js/chunk[name].${ mix.inProduction() ? '[chunkhash].' : '' }js`
},
plugins: [
new ImageminPlugin({
disable: process.env.NODE_ENV !== 'production', // Disable during development
pngquant: {
quality: '95-100',
},
test: /\.(jpe?g|png|gif|svg)$/i,
}),
// new WorkboxPlugin.InjectManifest({
// swSrc: path.join(DIST_DIR, 'sw.js'),
// }),
],
resolve: {
extensions: ['.js', '.json', '.vue'],
alias: {
'~': path.join(__dirname, './resources/assets/js'),
'!': path.join(__dirname, '/')
}
},
});