-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
fix(@aws-amplify/ui-react): Export CJS #5324
Merged
ericclemmons
merged 9 commits into
aws-amplify:master
from
ericclemmons:5282-exports-es5
Apr 8, 2020
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1c50406
Use build:* steps from aws-amplify-react
ericclemmons b9cbeec
Update build to use jsx for @aws-amplify/ui-react
ericclemmons 2f58d11
Module '"@types/react/index"' can only be default-imported using the …
ericclemmons 5872d33
Add missing webpack.configs for build:cjs
ericclemmons 426ba91
Remove unused tsconfig.json
ericclemmons 8a29a28
Add .npmignore from aws-amplify-react
ericclemmons c1d8b84
Update main/modules/typings paths
ericclemmons 7cc7d4a
esModuleInterop solves React.Component references
ericclemmons 417330a
Merge branch 'master' into 5282-exports-es5
sammartinez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
__mocks__/** | ||
__tests__/** | ||
coverage/** | ||
docs/** | ||
media/** | ||
node_modules/** | ||
test_Setup/** | ||
.vscode/** | ||
.DS_Store | ||
*.log | ||
lib/.tsbuildinfo | ||
lib-esm/.tsbuildinfo | ||
prepend-license.js | ||
cypress/** | ||
cypress.json | ||
tsc-out/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
|
||
const build = require('../../scripts/build'); | ||
|
||
build(process.argv[2], process.argv[3]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
var config = require('./webpack.config.js'); | ||
|
||
var entry = { | ||
'@aws-amplify/ui-react': './lib/index.js', | ||
}; | ||
module.exports = Object.assign(config, { entry, mode: 'development' }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
module.exports = { | ||
entry: { | ||
'aws-amplify-react.min': './lib/index.js', | ||
}, | ||
externals: [ | ||
'@aws-amplify/auth', | ||
'@aws-amplify/analytics', | ||
'@aws-amplify/api', | ||
'@aws-amplify/core', | ||
'@aws-amplify/interactions', | ||
'@aws-amplify/storage', | ||
'@aws-amplify/ui', | ||
'@aws-amplify/ui/dist/style.css', | ||
'@aws-amplify/xr', | ||
'aws-amplify', | ||
'react', | ||
], | ||
output: { | ||
filename: '[name].js', | ||
path: __dirname + '/dist', | ||
library: 'aws_amplify_react', | ||
libraryTarget: 'umd', | ||
umdNamedDefine: true, | ||
globalObject: 'this', | ||
devtoolModuleFilenameTemplate: require('../aws-amplify/webpack-utils') | ||
.devtoolModuleFilenameTemplate, | ||
}, | ||
// Enable sourcemaps for debugging webpack's output. | ||
devtool: 'source-map', | ||
resolve: { | ||
extensions: ['.js', '.json'], | ||
}, | ||
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?$/, | ||
exclude: /node_modules/, | ||
use: [ | ||
'babel-loader', | ||
{ | ||
loader: 'babel-loader', | ||
options: { | ||
presets: ['@babel/preset-env'], | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,9 +148,14 @@ function reportWatchStatusChanged(diagnostic, newLine, options, errorCount) { | |
} | ||
|
||
async function buildES5(typeScriptCompiler) { | ||
const jsx = packageInfo.name === 'aws-amplify-react' ? 'react' : undefined; | ||
const jsx = ['@aws-amplify/ui-react', 'aws-amplify-react'].includes( | ||
packageInfo.name | ||
) | ||
? 'react' | ||
: undefined; | ||
// tsconfig for ES5 generating | ||
let compilerOptions = { | ||
esModuleInterop: true, | ||
noImplicitAny: false, | ||
lib: ['dom', 'es2017', 'esnext.asynciterable'], | ||
downlevelIteration: true, | ||
|
@@ -188,9 +193,14 @@ async function buildES5(typeScriptCompiler) { | |
} | ||
|
||
function buildES6(typeScriptCompiler) { | ||
const jsx = packageInfo.name === 'aws-amplify-react' ? 'react' : undefined; | ||
const jsx = ['@aws-amplify/ui-react', 'aws-amplify-react'].includes( | ||
packageInfo.name | ||
) | ||
? 'react' | ||
: undefined; | ||
// tsconfig for ESM generating | ||
let compilerOptions = { | ||
esModuleInterop: true, | ||
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. Without this,
|
||
noImplicitAny: false, | ||
lib: ['dom', 'es2017', 'esnext.asynciterable'], | ||
downlevelIteration: true, | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do we have
includes
in our library? I believe we are using find but just want to make sure there are no build errors with using this.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.
Array.prototype.includes
has been in since Node 6, and it works locally & in CI.If there's another aspect I'm unaware of, I'm happy to swap it to
.find
.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.
.find
is what we use now, I believe it was something on the polyfill piece of it. @manueliglesias Do you have any clarity on this?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.
AS per our offline, I am fine. Approving