Skip to content

Commit

Permalink
chore: Update amazon-cognito-identity-js to use Webpack 5 (#11757)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimblanc authored Aug 9, 2023
1 parent ff94dc3 commit 57127c5
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 1,859 deletions.
11 changes: 2 additions & 9 deletions packages/amazon-cognito-identity-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"reactnative"
],
"scripts": {
"clean": "rimraf lib es",
"clean": "rimraf lib es dist",
"build:cjs": "cross-env BABEL_ENV=commonjs babel src --out-dir lib",
"build:cjs:watch": "cross-env BABEL_ENV=commonjs babel src --out-dir lib --watch",
"build:esm": "cross-env BABEL_ENV=es babel src --out-dir es",
Expand Down Expand Up @@ -67,18 +67,11 @@
"js-cookie": "^2.2.1"
},
"devDependencies": {
"@babel/cli": "7.17.0",
"@babel/core": "7.17.2",
"@babel/preset-env": "^7.7.4",
"@babel/preset-react": "^7.0.0",
"@react-native-async-storage/async-storage": "^1.17.12",
"babel-loader": "^8.0.6",
"cross-env": "^3.1.4",
"genversion": "^2.2.0",
"react": "^16.0.0",
"rimraf": "^2.5.4",
"terser-webpack-plugin": "^1.4.3",
"webpack": "^4.46.0",
"webpack-cli": "^4.10.0"
"compression-webpack-plugin": "^10.0.0"
}
}
39 changes: 25 additions & 14 deletions packages/amazon-cognito-identity-js/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Webpack version: ^4.46.0
const TerserPlugin = require('terser-webpack-plugin');
const CompressionPlugin = require("compression-webpack-plugin");

/* eslint-disable */
var webpack = require('webpack');
Expand All @@ -10,11 +10,14 @@ var banner =
' * SPDX-License-Identifier: Apache-2.0\n' +
' */\n\n';

var config = {
module.exports = {
entry: {
'amazon-cognito-identity': './src/index.js',
'amazon-cognito-identity.min': './src/index.js',
},
externals: {
crypto: 'crypto',
},
output: {
filename: '[name].js',
path: __dirname + '/dist',
Expand All @@ -23,35 +26,43 @@ var config = {
devtoolModuleFilenameTemplate: require('../aws-amplify/webpack-utils')
.devtoolModuleFilenameTemplate,
},
externals: {
crypto: 'crypto',
resolve: {
extensions: ['.js', '.json'],
},
mode: 'production',
plugins: [
new webpack.BannerPlugin({ banner, raw: true })
new webpack.BannerPlugin({ banner, raw: true }),
new CompressionPlugin({
include: /\.min\.js$/,
})
],
optimization: {
minimizer: [
new TerserPlugin({
sourceMap: true,
extractComments: false,
terserOptions: {
compress: true
compress: true,
sourceMap: true,
},
include: /\.min\.js$/,
})
]
},
mode: 'production',
module: {
rules: [
// All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
//{ enforce: 'pre', test: /\.js$/, loader: 'source-map-loader' },
{
test: /\.js$/,
test: /\.js?$/,
exclude: /node_modules/,
loader: 'babel-loader'
use: [
'babel-loader',
{
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
},
},
],
},
],
},
};

module.exports = config;
1 change: 1 addition & 0 deletions packages/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"dependencies": {
"@aws-amplify/core": "5.8.0",
"amazon-cognito-identity-js": "6.3.1",
"buffer": "4.9.2",
"tslib": "^1.8.0",
"url": "0.11.0"
},
Expand Down
1 change: 1 addition & 0 deletions packages/datastore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"@aws-amplify/auth": "5.6.0",
"@aws-amplify/core": "5.8.0",
"@aws-amplify/pubsub": "5.5.0",
"buffer": "4.9.2",
"amazon-cognito-identity-js": "6.3.1",
"idb": "5.0.6",
"immer": "9.0.6",
Expand Down
1 change: 1 addition & 0 deletions packages/pubsub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"@aws-amplify/auth": "5.6.0",
"@aws-amplify/cache": "5.1.6",
"@aws-amplify/core": "5.8.0",
"buffer": "4.9.2",
"graphql": "15.8.0",
"tslib": "^1.8.0",
"url": "0.11.0",
Expand Down
4 changes: 0 additions & 4 deletions packages/pushnotification/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@
"devDependencies": {
"@types/jest": "^20.0.8",
"@types/node": "^8.10.15",
"babel-loader": "^7.1.2",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"find": "^0.2.7",
"rimraf": "^2.6.2"
},
Expand Down
1 change: 1 addition & 0 deletions packages/storage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@aws-amplify/core": "5.8.0",
"@aws-sdk/md5-js": "3.6.1",
"@aws-sdk/types": "3.6.1",
"buffer": "4.9.2",
"events": "^3.1.0",
"fast-xml-parser": "^4.2.5",
"tslib": "^1.8.0"
Expand Down
Loading

0 comments on commit 57127c5

Please sign in to comment.