-
Notifications
You must be signed in to change notification settings - Fork 13
/
webpack.mix.js
74 lines (66 loc) · 1.37 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
const mix = require('laravel-mix');
const mixEnv = require('laravel-mix-environments');
const argv = require('yargs').argv;
// Add absolute path @ resolver.
mix.options({
webpackConfig: {
resolve: {
alias: {
'@': path.resolve('./'),
},
},
},
});
if (argv.env.entry=='src') {
// Main script file
mix
.js(
'src/index.js',
mix.inProduction() ?
'dist/vue-scrolly.min.js' :
'dist/vue-scrolly.js'
)
.extract([
'vue'
])
.options({
webpackConfig: {
output: {
library: 'Scrolly',
libraryTarget: 'umd',
umdNamedDefine: true
}
}
});
}
if (argv.env.entry=='demo') {
// Demo files
mix
.js('demo/src/main.js', 'demo/main.js')
.copy('demo/src/index.html', 'demo/index.html');
if (mix.inDevelopment()) {
// Dev Server
const port = 8012;
const publicPath = `http://localhost:${port}/`;
mix.options({
webpackConfig: {
output: {
publicPath: publicPath
},
devServer: {
port: port,
publicPath: publicPath,
public: `localhost:${port}`,
contentBase: './demo/',
noInfo: false,
quiet: false,
open: true,
overlay: {
warnings: true,
errors: true
}
}
}
});
}
}