Skip to content

Commit ba791ae

Browse files
committed
Web pack update
1 parent 9d304cb commit ba791ae

File tree

7 files changed

+56
-15
lines changed

7 files changed

+56
-15
lines changed

.npmignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,8 @@ webpack
1414
jest.config.js
1515
coverage
1616
CODEOWNERS
17+
src
18+
.env
19+
*.tgz
20+
.talismanrc
21+
tap-html.html

global.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// module.exports = window;

package.json

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
{
22
"name": "contentstack",
3-
"version": "3.15.0",
3+
"version": "3.15.1",
44
"description": "Contentstack Javascript SDK",
55
"homepage": "https://www.contentstack.com/",
66
"author": {
77
"name": "Contentstack",
88
"url": "https://www.contentstack.com/"
99
},
1010
"main": "dist/node/contentstack.js",
11+
"react-native": "dist/react-native/contentstack.js",
1112
"browser": "dist/web/contentstack.js",
1213
"types": "./index.d.ts",
1314
@@ -75,32 +76,35 @@
7576
"babel-runtime": "6.26.0",
7677
"clean-webpack-plugin": "^4.0.0",
7778
"compression-webpack-plugin": "1.0.1",
79+
"dotenv": "^16.0.0",
7880
"es3ify-loader": "0.2.0",
7981
"fetch-mock-jest": "^1.3.0",
8082
"http-proxy-agent": "^3.0.0",
8183
"istanbul": "^0.4.5",
82-
"jest": "^27.2.5",
83-
"jest-html-reporters": "^2.1.6",
84-
"jsdoc": "^3.6.7",
85-
"jshint": "^2.13.1",
84+
"jest": "^27.5.1",
85+
"jest-html-reporters": "^2.1.7",
86+
"jsdoc": "^3.6.10",
87+
"jshint": "^2.13.4",
8688
"node-request-interceptor": "^0.6.3",
87-
"nodemailer": "^6.6.5",
89+
"nodemailer": "^6.7.3",
8890
"request": "^2.88.2",
8991
"string-replace-loader": "1.3.0",
9092
"string-replace-webpack-plugin": "0.1.3",
9193
"tap-html": "^1.0.1",
9294
"tap-json": "1.0.0",
9395
"tape": "4.8.0",
94-
"ts-jest": "^27.0.0-next.12",
95-
"typescript": "^4.4.3",
96+
"terser-webpack-plugin": "^5.3.1",
97+
"ts-jest": "^27.1.4",
98+
"typescript": "^4.6.3",
9699
"uglify-js": "2.8.29",
97-
"webpack": "^5.59.0",
98-
"webpack-cli": "^4.9.0",
100+
"webpack": "^5.70.0",
101+
"webpack-cli": "^4.9.2",
99102
"webpack-md5-hash": "0.0.5",
100-
"webpack-merge": "4.1.0"
103+
"webpack-merge": "4.1.0",
104+
"webpack-node-externals": "^3.0.0"
101105
},
102106
"dependencies": {
103-
"@contentstack/utils": "^1.1.0",
107+
"@contentstack/utils": "^1.1.1",
104108
"es6-promise": "^4.1.1",
105109
"isomorphic-fetch": "^3.0.0",
106110
"localStorage": "1.0.3"

webpack/webpack.nativescript.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,22 @@
22

33
const path = require('path');
44
const webpackMerge = require('webpack-merge');
5+
var nodeExternals = require('webpack-node-externals');
56

67
const commonConfig = require('./webpack.common.js');
78

89
module.exports = function(options) {
910
return webpackMerge(commonConfig(), {
1011
output: {
11-
library: "Contentstack",
1212
libraryTarget: "commonjs2",
1313
path: path.join(__dirname, "../dist/nativescript"),
1414
filename: "contentstack.js"
1515
},
16+
target: "node",
17+
externals: [nodeExternals()],
18+
externalsPresets: {
19+
node: true
20+
},
1621
resolve: {
1722
alias: {
1823
runtime: path.resolve(__dirname, '../src/runtime/nativescript')

webpack/webpack.node.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22
const path = require('path');
33
const webpackMerge = require('webpack-merge');
4+
var nodeExternals = require('webpack-node-externals');
45

56
const commonConfig = require('./webpack.common.js');
67

@@ -12,6 +13,10 @@ module.exports = function(options) {
1213
filename: "contentstack.js"
1314
},
1415
target: "node",
16+
externals: [nodeExternals()],
17+
externalsPresets: {
18+
node: true
19+
},
1520
resolve: {
1621
alias: {
1722
runtime: path.resolve(__dirname, '../src/runtime/node')

webpack/webpack.react-native.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
const path = require('path');
44
const webpackMerge = require('webpack-merge');
5+
const TerserPlugin = require("terser-webpack-plugin");
6+
var nodeExternals = require('webpack-node-externals');
57

68
const commonConfig = require('./webpack.common.js');
79

810
module.exports = function(options) {
911
return webpackMerge(commonConfig(), {
1012
output: {
11-
library: "Contentstack",
1213
libraryTarget: "commonjs2",
1314
path: path.join(__dirname, "../dist/react-native"),
1415
filename: "contentstack.js"
@@ -23,6 +24,17 @@ module.exports = function(options) {
2324
'node_modules',
2425
]
2526
},
27+
target: 'node',
28+
externals: [nodeExternals()],
29+
externalsPresets: {
30+
node: true
31+
},
32+
optimization: {
33+
minimize: true,
34+
minimizer: [new TerserPlugin({
35+
terserOptions: { output: { ascii_only: true } }
36+
})],
37+
},
2638
module: {
2739
rules: [{
2840
test: /\.js?$/,

webpack/webpack.web.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const path = require('path');
44
const webpackMerge = require('webpack-merge');
55

66
const commonConfig = require('./webpack.common.js');
7+
const webpack = require('webpack');
78

89
module.exports = function(options) {
910
return webpackMerge(commonConfig(), {
@@ -35,6 +36,14 @@ module.exports = function(options) {
3536
}
3637
}],
3738
}]
38-
}
39+
},
40+
node: {
41+
global: false
42+
},
43+
plugins: [
44+
new webpack.ProvidePlugin({
45+
global: require.resolve('./../global.js')
46+
})
47+
]
3948
});
4049
}

0 commit comments

Comments
 (0)