-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
49 lines (48 loc) · 1.73 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
const path = require('path');
const webpack = require('webpack');
const bundleOutputDir = './build';
module.exports = (env) => {
const isDevBuild = !(env && env.prod);
return [{
mode: "none",
stats: { modules: false },
entry: { 'main': './index.ts' },
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx', '.less', '.sass', '.scss']
},
output: {
filename: 'nserializejson.min.js',
path: path.join(__dirname, 'dist', 'browser'),
library: "NSerializeJson",
libraryTarget: "umd",
globalObject: "typeof self !== 'undefined' ? self : this"
},
module: {
rules: [
{
test: /\.tsx?$/,
include: /src/,
exclude: /node_modules/,
use: [{
loader: 'babel-loader',
options: {
plugins: [require('babel-plugin-add-module-exports')]
}
},
'ts-loader']
},
]
},
plugins: [
].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()
])
}];
};