diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..09a96e1 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,16 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Launch Program", + "skipFiles": ["/**"], + "runtimeExecutable": "npm", + "runtimeArgs": ["run-script", "build"] + } + ] +} diff --git a/README.md b/README.md index 5141157..80f0200 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # react + [![npm version](https://img.shields.io/npm/v/@esm-bundle/react.svg?style=flat)](https://www.npmjs.com/package/@esm-bundle/react) [![build status](https://travis-ci.com/esm-bundle/react.svg?branch=master)](https://travis-ci.com/esm-bundle/react) [![](https://data.jsdelivr.com/v1/package/npm/@esm-bundle/react/badge)](https://www.jsdelivr.com/package/npm/@esm-bundle/react) An ESM version of React. diff --git a/browser-test/test.js b/browser-test/test.js index 1c9f3dc..7bf3eaf 100644 --- a/browser-test/test.js +++ b/browser-test/test.js @@ -1,17 +1,25 @@ describe("@esm-bundle/react", () => { - it("can load the ESM development bundle", () => { - return import("/base/esm/react.development.js"); + it("can load the ESM development bundle", async () => { + const React = await import("/base/esm/react.development.js"); + React.default.createElement("button"); + React.createElement("button"); }); - it("can load the ESM production bundle", () => { - return import("/base/esm/react.production.min.js"); + it("can load the ESM production bundle", async () => { + const React = await import("/base/esm/react.development.js"); + React.default.createElement("button"); + React.createElement("button"); }); - it("can load the System.register development bundle", () => { - return System.import("/base/system/react.development.js"); + it("can load the System.register development bundle", async () => { + const React = await System.import("/base/system/react.development.js"); + React.default.createElement("button"); + React.createElement("button"); }); - it("can load the System.register production bundle", () => { - return System.import("/base/system/react.production.min.js"); + it("can load the System.register production bundle", async () => { + const React = await System.import("/base/system/react.development.js"); + React.default.createElement("div"); + React.createElement("div"); }); }); diff --git a/package.json b/package.json index dda6a96..827d9ef 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "prettier": "1.19.1", "pretty-quick": "2.0.1", "prop-types": "15.7.2", - "react": "16.12.0", + "react": "16.13.0", "release-it": "12.4.3", "release-it-plugin-esm-bundle": "2.0.0", "rimraf": "3.0.0", diff --git a/rollup.config.js b/rollup.config.js index dd6e90e..67cef32 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -15,16 +15,11 @@ function createDevConfig(format) { format, file: `${dir}/react.development.js`, sourcemap: true, - banner: `/* react@${DevReact.version} development version */` + banner: `/* react@${DevReact.version} development version */`, + exports: "named" }, plugins: [ - commonjs({ - namedExports: { - [require.resolve("react/cjs/react.development.js")]: Object.keys( - DevReact - ) - } - }), + commonjs(), resolve(), replace({ values: { @@ -42,16 +37,11 @@ function createProdConfig(format) { format, file: `${format}/react.production.min.js`, sourcemap: true, - banner: `/* react@${ProdReact.version} production version */` + banner: `/* react@${ProdReact.version} production version */`, + exports: "named" }, plugins: [ - commonjs({ - namedExports: { - [require.resolve("react/cjs/react.production.min.js")]: Object.keys( - ProdReact - ) - } - }), + commonjs(), resolve(), replace({ values: { diff --git a/yarn.lock b/yarn.lock index 7e8a0d6..c55ff60 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4499,10 +4499,10 @@ react-is@^16.12.0, react-is@^16.8.1: resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.12.0.tgz#2cc0fe0fba742d97fd527c42a13bec4eeb06241c" integrity sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q== -react@16.12.0: - version "16.12.0" - resolved "https://registry.yarnpkg.com/react/-/react-16.12.0.tgz#0c0a9c6a142429e3614834d5a778e18aa78a0b83" - integrity sha512-fglqy3k5E+81pA8s+7K0/T3DBCF0ZDOher1elBFzF7O6arXJgzyu/FW+COxFvAWXJoJN9KIZbT2LXlukwphYTA== +react@16.13.0: + version "16.13.0" + resolved "https://registry.yarnpkg.com/react/-/react-16.13.0.tgz#d046eabcdf64e457bbeed1e792e235e1b9934cf7" + integrity sha512-TSavZz2iSLkq5/oiE7gnFzmURKZMltmi193rm5HEoUDAXpzT9Kzw6oNZnGoai/4+fUnm7FqS5dwgUL34TujcWQ== dependencies: loose-envify "^1.1.0" object-assign "^4.1.1"