-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.lib.js
More file actions
72 lines (70 loc) · 1.65 KB
/
webpack.lib.js
File metadata and controls
72 lines (70 loc) · 1.65 KB
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
const webpack = require('webpack');
const path = require('path');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const uglifyJsPlugin = require('uglifyjs-webpack-plugin');
const PACKAGE = require('./package.json');
const banner = PACKAGE.name + ' - ' + PACKAGE.version + ' | ' +
'(c) ' + new Date().getFullYear() + ', ' + PACKAGE.author + ' | ' +
PACKAGE.license + ' | ' +
PACKAGE.homepage;
console.log('webpack __dirname', __dirname);
module.exports = env => {
return [
{
entry: { 'ecljs': "./src/index.ts" },
mode: 'development',
devtool: 'source-map',
output: {
library: 'ecljs',
libraryTarget: 'umd',
//globalObject: 'this',
path: path.resolve(__dirname, 'dist'),
filename: '[name].js'
},
module: {
rules: [
{
test: /\.(ts|js)x?$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
]
},
plugins: [
new uglifyJsPlugin(),
new webpack.BannerPlugin(banner),
],
resolve: {
extensions: ['.js', '.ts', '.tsx', '.jsx', '.json']
}
},
{
entry: { 'ecljs.min': "./src/index.ts" },
mode: "production",
output: {
library: 'ecljs',
libraryTarget: 'umd',
//globalObject: 'this',
path: path.resolve(__dirname, 'dist'),
filename: '[name].js'
},
module: {
rules: [
{
test: /\.(ts|js)x?$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
]
},
plugins: [
new uglifyJsPlugin(),
new webpack.BannerPlugin(banner),
],
resolve: {
plugins: [new TsconfigPathsPlugin({ configFile: "./tsconfig.prod.json" })],
extensions: ['.js', '.ts', '.tsx', '.jsx', '.json']
}
},
];
}