-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.mix.js
98 lines (94 loc) · 2.85 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
let mix = require('laravel-mix');
/*
|--------------------------------------------------------------------------
| 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.
|
*/
const appPath = path.resolve(__dirname, 'resources', 'assets', 'admin-spa');
mix.webpackConfig({
node: {
fs: "empty"
},
output: {
publicPath: '/vendor/ecommerce/',
chunkFilename: 'js/chunks/[name].js',
},
module: {
rules: [
{
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /node_modules/
}
],
loaders: [
{
test: /\.jsx$/,
loader: 'babel'
},
{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/
},
{
test: /\.ejs$/,
loader: 'ejs-loader',
},
]
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.runtime.esm.js',
'axios': 'axios/dist/axios.min.js',
'components': path.resolve(appPath, 'components'),
'pages': path.resolve(appPath, 'pages'),
'services': path.resolve(appPath, 'services'),
'utils': path.resolve(appPath, 'utils'),
}
}
});
mix.setPublicPath('public')
.options({
uglify: {
uglifyOptions: {
compress: {
drop_console: true,
warnings: false,
conditionals: true,
unused: true,
comparisons: false,
sequences: true,
dead_code: true,
evaluate: true,
if_return: true,
join_vars: true,
}
}
}
})
.js('resources/assets/admin-spa/admin.js', 'public/js/admin.js')
.styles(['node_modules/normalize.css/normalize.css'], 'public/css/reset.css')
.copy('node_modules/element-ui/lib/theme-chalk/fonts/', 'public/fonts')
.sass('resources/assets/admin-spa/sass/admin.scss', 'public/css/admin.css')
.extract(['vue', 'element-ui', 'vue-router', 'vuex', 'axios', 'vue-quill-editor'])
.version();
if (!mix.inProduction()) {
mix.browserSync({
open: 'external',
host: 'laravel-package-development.test',
proxy: 'http://laravel-package-development.test/admin',
browser: "google chrome",
files: [
'resources/assets/admin-spa/**/*.js',
'resources/assets/admin-spa/**/*.vue',
]
});
mix.copy('public', '../../public/vendor/ecommerce');
}