-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
36 lines (35 loc) · 883 Bytes
/
webpack.config.js
File metadata and controls
36 lines (35 loc) · 883 Bytes
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
const path = require('path');
const DeclarationBundlerPlugin = require('bundle-dts-webpack-plugin');
const nodeExternals = require('webpack-node-externals');
const pkg = require('./package.json');
module.exports = (env, argv) => [
{ name: "declarativ.min.js", target: "umd", bundleDependencies: true },
{ name: "index.js", target: "commonjs2" }
].map(opts => ({
entry: './src/index.ts',
output: {
path: path.resolve(__dirname, 'dist'),
filename: opts.name,
library: 'declarativ',
libraryTarget: opts.target
},
externals: opts.bundleDependencies ? [] : [nodeExternals()],
module: {
rules: [
{
test: /\.tsx?$/,
include: path.resolve(__dirname, 'src'),
loader: 'ts-loader'
}
]
},
resolve: {
extensions: [ '.tsx', '.ts', '.js' ]
},
plugins: [
new DeclarationBundlerPlugin({
moduleName: "'declarativ'",
out: "./types.d.ts"
})
]
}));