-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.mix.js
executable file
·64 lines (59 loc) · 1.65 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
57
58
59
60
61
62
63
64
/* eslint-disable import/no-extraneous-dependencies, @typescript-eslint/no-var-requires */
const mix = require('laravel-mix');
const Dotenv = require('dotenv-webpack');
const devMode = !mix.inProduction();
const webpack = require('webpack');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
require('laravel-mix-bundle-analyzer');
require('laravel-mix-polyfill');
mix
.ts('resources/js/main.ts', 'public/js')
.ts('resources/js/check-support.ts', 'public/js')
.vue({
extractStyles: true,
})
.extract()
.sass('resources/sass/nova.scss', 'public/css/nova.css')
.sass('resources/sass/app.scss', 'public/css')
.polyfill({
enabled: true,
useBuiltIns: 'entry',
targets: '> 1%, last 5 versions, not dead, not IE 11, Safari > 10',
corejs: 3,
})
.version()
.copyDirectory('resources/img', 'public/images')
.browserSync({
proxy: '0.0.0.0:8080',
open: false,
});
mix.webpackConfig({
plugins: [
new webpack.DefinePlugin({
__VUE_OPTIONS_API__: true,
__VUE_PROD_DEVTOOLS__: false,
}),
new Dotenv(),
new webpack.ContextReplacementPlugin(
/moment[\\/\\]locale$/,
/en|ru/,
),
new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: ['css/*', 'js/*'],
}),
],
output: {
chunkFilename: 'js/[name].[contenthash].js',
},
});
if (devMode) {
mix.sourceMaps(false, 'source-map');
}
if (process.env.SHOW_STAT === 'true') {
mix.bundleAnalyzer(
{
analyzerHost: '0.0.0.0',
analyzerPort: '3000',
},
);
}