-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathwebpack.config.js
68 lines (67 loc) · 1.69 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* global __dirname */
const webpack = require('webpack');
const path = require('path');
const package = require('./package.json');
const buildDate = new Date();
console.log('JSON Schema Form Core v' + package.version);
const plugins = [
new webpack.BannerPlugin(
'json-schema-form-core\n' +
'@version ' + package.version + '\n' +
'@date ' + buildDate.toUTCString() + '\n' +
'@link https://github.com/json-schema-form/json-schema-form-core\n' +
'@license MIT\n' +
'Copyright (c) 2014-' + buildDate.getFullYear() + ' JSON Schema Form'),
/* Minification only occurs if the output is named .min */
new webpack.optimize.UglifyJsPlugin(
{
include: /\.min\.js$/,
minimize: true
})
];
const library = 'JSONSchemaFormCore';
module.exports = {
entry: {
"json-schema-form-core": [ path.join(__dirname, 'src', 'module') ]
},
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].js',
library: library,
libraryTarget: 'commonjs2'
},
resolve: {
modules: [
path.join(__dirname, "src"),
path.join(__dirname, "src/lib"),
"node_modules"
],
extensions: [ '.ts', '.js' ]
},
target: 'node',
module: {
rules: [
{
test: /\.js$/,
use: [{
loader: 'babel-loader',
options: {
babelrc: false,
presets: [
["es2015", { "modules": false }]
],
plugins: [ "transform-flow-strip-types" ]
}
}],
exclude: /node_modules/
},
{
test: /\.ts/,
use: [ 'babel-loader', 'ts-loader' ],
exclude: /node_modules/
}
]
},
devtool: 'source-map',
plugins: plugins
};