Skip to content

Commit

Permalink
Web pack update
Browse files Browse the repository at this point in the history
  • Loading branch information
uttamukkoji committed Mar 30, 2022
1 parent 9d304cb commit ba791ae
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ webpack
jest.config.js
coverage
CODEOWNERS
src
.env
*.tgz
.talismanrc
tap-html.html
1 change: 1 addition & 0 deletions global.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// module.exports = window;
28 changes: 16 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "contentstack",
"version": "3.15.0",
"version": "3.15.1",
"description": "Contentstack Javascript SDK",
"homepage": "https://www.contentstack.com/",
"author": {
"name": "Contentstack",
"url": "https://www.contentstack.com/"
},
"main": "dist/node/contentstack.js",
"react-native": "dist/react-native/contentstack.js",
"browser": "dist/web/contentstack.js",
"types": "./index.d.ts",
"_id": "[email protected]",
Expand Down Expand Up @@ -75,32 +76,35 @@
"babel-runtime": "6.26.0",
"clean-webpack-plugin": "^4.0.0",
"compression-webpack-plugin": "1.0.1",
"dotenv": "^16.0.0",
"es3ify-loader": "0.2.0",
"fetch-mock-jest": "^1.3.0",
"http-proxy-agent": "^3.0.0",
"istanbul": "^0.4.5",
"jest": "^27.2.5",
"jest-html-reporters": "^2.1.6",
"jsdoc": "^3.6.7",
"jshint": "^2.13.1",
"jest": "^27.5.1",
"jest-html-reporters": "^2.1.7",
"jsdoc": "^3.6.10",
"jshint": "^2.13.4",
"node-request-interceptor": "^0.6.3",
"nodemailer": "^6.6.5",
"nodemailer": "^6.7.3",
"request": "^2.88.2",
"string-replace-loader": "1.3.0",
"string-replace-webpack-plugin": "0.1.3",
"tap-html": "^1.0.1",
"tap-json": "1.0.0",
"tape": "4.8.0",
"ts-jest": "^27.0.0-next.12",
"typescript": "^4.4.3",
"terser-webpack-plugin": "^5.3.1",
"ts-jest": "^27.1.4",
"typescript": "^4.6.3",
"uglify-js": "2.8.29",
"webpack": "^5.59.0",
"webpack-cli": "^4.9.0",
"webpack": "^5.70.0",
"webpack-cli": "^4.9.2",
"webpack-md5-hash": "0.0.5",
"webpack-merge": "4.1.0"
"webpack-merge": "4.1.0",
"webpack-node-externals": "^3.0.0"
},
"dependencies": {
"@contentstack/utils": "^1.1.0",
"@contentstack/utils": "^1.1.1",
"es6-promise": "^4.1.1",
"isomorphic-fetch": "^3.0.0",
"localStorage": "1.0.3"
Expand Down
7 changes: 6 additions & 1 deletion webpack/webpack.nativescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@

const path = require('path');
const webpackMerge = require('webpack-merge');
var nodeExternals = require('webpack-node-externals');

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

module.exports = function(options) {
return webpackMerge(commonConfig(), {
output: {
library: "Contentstack",
libraryTarget: "commonjs2",
path: path.join(__dirname, "../dist/nativescript"),
filename: "contentstack.js"
},
target: "node",
externals: [nodeExternals()],
externalsPresets: {
node: true
},
resolve: {
alias: {
runtime: path.resolve(__dirname, '../src/runtime/nativescript')
Expand Down
5 changes: 5 additions & 0 deletions webpack/webpack.node.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';
const path = require('path');
const webpackMerge = require('webpack-merge');
var nodeExternals = require('webpack-node-externals');

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

Expand All @@ -12,6 +13,10 @@ module.exports = function(options) {
filename: "contentstack.js"
},
target: "node",
externals: [nodeExternals()],
externalsPresets: {
node: true
},
resolve: {
alias: {
runtime: path.resolve(__dirname, '../src/runtime/node')
Expand Down
14 changes: 13 additions & 1 deletion webpack/webpack.react-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

const path = require('path');
const webpackMerge = require('webpack-merge');
const TerserPlugin = require("terser-webpack-plugin");
var nodeExternals = require('webpack-node-externals');

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

module.exports = function(options) {
return webpackMerge(commonConfig(), {
output: {
library: "Contentstack",
libraryTarget: "commonjs2",
path: path.join(__dirname, "../dist/react-native"),
filename: "contentstack.js"
Expand All @@ -23,6 +24,17 @@ module.exports = function(options) {
'node_modules',
]
},
target: 'node',
externals: [nodeExternals()],
externalsPresets: {
node: true
},
optimization: {
minimize: true,
minimizer: [new TerserPlugin({
terserOptions: { output: { ascii_only: true } }
})],
},
module: {
rules: [{
test: /\.js?$/,
Expand Down
11 changes: 10 additions & 1 deletion webpack/webpack.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const path = require('path');
const webpackMerge = require('webpack-merge');

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

module.exports = function(options) {
return webpackMerge(commonConfig(), {
Expand Down Expand Up @@ -35,6 +36,14 @@ module.exports = function(options) {
}
}],
}]
}
},
node: {
global: false
},
plugins: [
new webpack.ProvidePlugin({
global: require.resolve('./../global.js')
})
]
});
}

0 comments on commit ba791ae

Please sign in to comment.