-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.react.js
52 lines (43 loc) · 1.2 KB
/
webpack.config.react.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 packageJson = require('./package.json');
const publishPackageJson = require('./publish/package.json');
const GeneratePackageJsonPlugin = require('generate-package-json-webpack-plugin');
const CopyPlugin = require("copy-webpack-plugin");
const [ dev, prod ] = require('./webpack.config.js');
publishPackageJson.name = "table4react";
publishPackageJson.version = packageJson.version;
publishPackageJson.dependencies = {
"react": "^18.2.0",
"react-dom": "^18.2.0"
}
const entry = {
table4: './sources/react/index.ts',
};
const externals = {
'react': {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react',
umd: 'react'
},
'react-dom': {
root: 'ReactDOM',
commonjs2: 'react-dom',
commonjs: 'react-dom',
amd: 'react-dom',
umd: 'react-dom'
}
}
dev.entry = entry;
prod.entry = entry;
dev.externals = externals;
prod.externals = externals;
dev.output.path = __dirname + '/site/dist/react';
prod.output.path = __dirname + '/site/dist/react';
prod.plugins.push(new GeneratePackageJsonPlugin(publishPackageJson));
prod.plugins.push(new CopyPlugin({
patterns: [
{ from: "publish/react.md", to: "README.md" }
],
}));
module.exports = [ dev, prod ];