-
Notifications
You must be signed in to change notification settings - Fork 2.2k
chore: Update amazon-cognito-identity-js to use Webpack 5
#11757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
98d4505
82ddfc7
397a7fa
e52d926
c9034f1
bbeaab9
68635fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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'); | ||
|
|
@@ -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', | ||
|
|
@@ -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, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not true?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was done to preserve the current artifact structure where license comments are embedded in the JS directly (vs being extracted into a |
||
| 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; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 good catch