Skip to content

Commit 2e26570

Browse files
fix: update build targets
1 parent 1dcd3d4 commit 2e26570

File tree

3 files changed

+3070
-3054
lines changed

3 files changed

+3070
-3054
lines changed

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "2.0.0",
44
"description": "React interface for working with unleash",
55
"main": "./dist/index.js",
6+
"browser": "./dist/index.browser.js",
67
"types": "./dist/src/index.d.ts",
78
"files": [
89
"dist",
@@ -36,12 +37,15 @@
3637
"react": "^17.0.2",
3738
"react-dom": "^17.0.2",
3839
"react-test-renderer": "^17.0.2",
39-
"unleash-proxy-client": "v2.0.0",
4040
"ts-jest": "^27.0.5",
4141
"ts-loader": "^9.1.1",
4242
"ts-node": "^10.2.1",
4343
"typescript": "^4.4.3",
4444
"webpack": "^5.35.1",
45-
"webpack-cli": "^4.6.0"
45+
"webpack-cli": "^4.6.0",
46+
"unleash-proxy-client": "v2.0.0"
47+
},
48+
"peerDependencies": {
49+
"unleash-proxy-client": "v2.0.0"
4650
}
4751
}

webpack.config.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
var path = require('path');
22

3-
module.exports = {
3+
const getCommonConfig = (outputFileName) => ({
44
entry: './src/index.ts',
5-
target: 'node',
65
output: {
76
path: path.resolve(__dirname, 'dist'),
8-
filename: 'index.js',
7+
filename: outputFileName,
98
libraryTarget: 'commonjs2',
109
},
1110
module: {
@@ -20,5 +19,17 @@ module.exports = {
2019
resolve: {
2120
extensions: ['.tsx', '.ts', '.js'],
2221
},
23-
externals: ['commonjs', 'react'],
22+
externals: ['commonjs', 'react', 'unleash-proxy-client'],
23+
});
24+
25+
const client = {
26+
...getCommonConfig('index.browser.js'),
27+
target: 'web',
28+
};
29+
30+
const server = {
31+
...getCommonConfig('index.js'),
32+
target: 'node',
2433
};
34+
35+
module.exports = [client, server];

0 commit comments

Comments
 (0)