-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.babel.js
63 lines (53 loc) · 1.26 KB
/
webpack.config.babel.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
import path from 'path';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import { VueLoaderPlugin } from 'vue-loader';
const resolve = file => path.resolve(__dirname, file);
const isProd = process.argv.indexOf('-p') !== -1;
const config = {
mode: isProd ? 'production' : 'development',
entry: isProd ? resolve('src/index.js') : resolve('docs/src/index.js'),
output: {
filename: 'index.js',
libraryTarget: 'umd',
library: 'VueMapfit',
// used to prevent window object in resulting library code
// https://github.com/webpack/webpack/issues/6525
globalObject: 'this',
},
resolve: {
extensions: ['.vue', '.js', '.json'],
alias: {
src: resolve('src'),
},
},
module: {
rules: [
{
test: /\.(js|vue)$/,
enforce: 'pre',
use: 'eslint-loader',
exclude: /node_modules/,
},
{
test: /\.js$/,
use: 'babel-loader',
exclude: /node_modules/,
},
{
test: /\.vue$/,
loader: 'vue-loader',
},
],
},
plugins: [
new VueLoaderPlugin(),
new HtmlWebpackPlugin({
template: resolve('docs/index.html'),
inject: true,
}),
],
devServer: {
contentBase: resolve('docs'),
},
};
export default config;