-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
52 lines (49 loc) · 1.66 KB
/
webpack.config.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
const path = require('path');
const webpack = require('webpack');
const bundleOutputDir = './build';
module.exports = (env) => {
const isDevBuild = !(env && env.prod);
return [{
target: 'web',
stats: { modules: false },
entry: { 'main': './index.ts' },
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx', '.less', '.sass', '.scss']
},
output: {
filename: 'nval-tippy.min.js',
path: path.join(__dirname, 'dist', 'browser'),
library: 'NValTippy',
libraryTarget: "umd",
globalObject: "typeof self !== 'undefined' ? self : this"
},
module: {
rules: [
{
test: /\.tsx?$/,
include: /src/,
exclude: /node_modules/,
use: ['babel-loader', 'ts-loader']
}
]
},
externals: {
"tippy.js": "tippy.js",
"nval": "NVal"
},
plugins: [
new webpack.ProvidePlugin({
nval: 'NVal'
}),
].concat(isDevBuild ? [
// Plugins that apply in development builds only
new webpack.SourceMapDevToolPlugin({
filename: '[file].map', // Remove this line if you prefer inline source maps
moduleFilenameTemplate: path.relative(bundleOutputDir, '[resourcePath]') // Point sourcemap entries to the original file locations on disk
})
] : [
// Plugins that apply in production builds only
new webpack.optimize.UglifyJsPlugin()
])
}];
};