-
-
Notifications
You must be signed in to change notification settings - Fork 376
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: correct esm configuration for loadable/server, fixes: #999
- Loading branch information
Showing
10 changed files
with
203 additions
and
28 deletions.
There are no files selected for viewing
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,59 @@ | ||
{ | ||
"lib/cjs/index.js": { | ||
"bundled": 18664, | ||
"minified": 10144, | ||
"gzipped": 2837 | ||
}, | ||
"lib/esm/index.js": { | ||
"bundled": 18299, | ||
"minified": 9859, | ||
"gzipped": 2766, | ||
"treeshaked": { | ||
"rollup": { | ||
"code": 279, | ||
"import_statements": 235 | ||
}, | ||
"webpack": { | ||
"code": 13218 | ||
} | ||
} | ||
}, | ||
"dist/loadable-server.cjs.js": { | ||
"bundled": 18664, | ||
"minified": 10144, | ||
"gzipped": 2837 | ||
}, | ||
"dist/loadable-server.esm.mjs": { | ||
"bundled": 18299, | ||
"minified": 9859, | ||
"gzipped": 2766, | ||
"treeshaked": { | ||
"rollup": { | ||
"code": 279, | ||
"import_statements": 235 | ||
}, | ||
"webpack": { | ||
"code": 13218 | ||
} | ||
} | ||
}, | ||
"dist/cjs/loadable-server.cjs.js": { | ||
"bundled": 18664, | ||
"minified": 10144, | ||
"gzipped": 2837 | ||
}, | ||
"dist/esm/loadable-server.esm.mjs": { | ||
"bundled": 18299, | ||
"minified": 9859, | ||
"gzipped": 2766, | ||
"treeshaked": { | ||
"rollup": { | ||
"code": 279, | ||
"import_statements": 235 | ||
}, | ||
"webpack": { | ||
"code": 13218 | ||
} | ||
} | ||
} | ||
} |
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 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,48 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import nodeResolve from 'rollup-plugin-node-resolve' | ||
import babel from 'rollup-plugin-babel' | ||
import replace from 'rollup-plugin-replace' | ||
import commonjs from 'rollup-plugin-commonjs' | ||
import { terser } from 'rollup-plugin-terser' | ||
import { sizeSnapshot } from 'rollup-plugin-size-snapshot' | ||
import pkg from './package.json' | ||
|
||
const input = 'src/index.js' | ||
const name = 'loadable' | ||
const globals = { | ||
react: 'React', | ||
'hoist-non-react-statics': 'hoistNonReactStatics', | ||
} | ||
|
||
const external = id => !id.startsWith('.') && !id.startsWith('/') | ||
|
||
const getBabelOptions = ({ useESModules }) => ({ | ||
exclude: '**/node_modules/**', | ||
runtimeHelpers: true, | ||
presets: [ | ||
['@babel/preset-env', { loose: true }], | ||
['@babel/preset-react', { useBuiltIns: true }], | ||
], | ||
plugins: [ | ||
'@babel/plugin-proposal-class-properties', | ||
'babel-plugin-annotate-pure-calls', | ||
['@babel/plugin-transform-runtime', { useESModules }], | ||
], | ||
}) | ||
|
||
export default [ | ||
// cjs | ||
{ | ||
input, | ||
output: { file: pkg.main, format: 'cjs', exports: 'named' }, | ||
external, | ||
plugins: [babel(getBabelOptions({ useESModules: false })), sizeSnapshot()], | ||
}, | ||
// esm | ||
{ | ||
input, | ||
output: { file: pkg.module, format: 'esm' }, | ||
external, | ||
plugins: [babel(getBabelOptions({ useESModules: true })), sizeSnapshot()], | ||
}, | ||
] |
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 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 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 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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export { default as ChunkExtractorManager } from './ChunkExtractorManager.js' | ||
export { default as ChunkExtractor } from './ChunkExtractor.js' | ||
export { default as ChunkExtractorManager } from './ChunkExtractorManager' | ||
export { default as ChunkExtractor } from './ChunkExtractor' |
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 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,76 @@ | ||
Arguments: | ||
/Users/akorzunov/.nvm/versions/node/v16.20.2/bin/node /opt/homebrew/Cellar/yarn/1.22.19/libexec/bin/yarn.js run prepublishOnly | ||
|
||
PATH: | ||
/Users/akorzunov/.nvm/versions/node/v16.20.2/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/opt/atlassian/bin | ||
|
||
Yarn version: | ||
1.22.19 | ||
|
||
Node version: | ||
16.20.2 | ||
|
||
Platform: | ||
darwin arm64 | ||
|
||
Trace: | ||
SyntaxError: /Users/akorzunov/dev/github/loaders/loadable-components/packages/server/package.json: Unexpected token } in JSON at position 1190 | ||
at JSON.parse (<anonymous>) | ||
at /opt/homebrew/Cellar/yarn/1.22.19/libexec/lib/cli.js:1629:59 | ||
at Generator.next (<anonymous>) | ||
at step (/opt/homebrew/Cellar/yarn/1.22.19/libexec/lib/cli.js:310:30) | ||
at /opt/homebrew/Cellar/yarn/1.22.19/libexec/lib/cli.js:321:13 | ||
|
||
npm manifest: | ||
{ | ||
"name": "@loadable/server", | ||
"description": "Server utilities for loadable.", | ||
"version": "5.16.2", | ||
"type": "module", | ||
"main": "./dist/cjs/loadable-server.cjs.js", | ||
"module": "./dist/esm/loadable-server.esm.mjs", | ||
"exports": { | ||
".": { | ||
"require": "./dist/cjs/loadable-server.cjs.js", | ||
"import": "./dist/esm/loadable-server.esm.mjs", | ||
"default": "./dist/cjs/loadable-server.cjs.js" | ||
} | ||
}, | ||
"repository": "git@github.com:gregberge/loadable-components.git", | ||
"author": "Greg Bergé <berge.greg@gmail.com>", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"keywords": [ | ||
"loadable" | ||
], | ||
"engines": { | ||
"node": ">=8" | ||
}, | ||
"funding": { | ||
"type": "github", | ||
"url": "https://github.com/sponsors/gregberge" | ||
}, | ||
"license": "MIT", | ||
"scripts": { | ||
"prebuild": "shx rm -rf dist", | ||
"build": "cross-env rollup -c && yarn create-cjs-package-json", | ||
"create-cjs-package-json": "echo '{\"type\": \"commonjs\"}' > ./lib/cjs/package.json", | ||
"prepublishOnly": "yarn run build", | ||
"update-fixtures": "yarn --cwd ../../examples/__fixtures__ build:webpack && rm -rf ./__fixtures__ && cp -R ../../examples/__fixtures__/target ./__fixtures__ ", | ||
|
||
}, | ||
"peerDependencies": { | ||
"@loadable/component": "^5.0.1", | ||
"react": "^16.3.0 || ^17.0.0 || ^18.0.0" | ||
}, | ||
"dependencies": { | ||
"lodash": "^4.17.15" | ||
} | ||
} | ||
|
||
yarn manifest: | ||
No manifest | ||
|
||
Lockfile: | ||
No lockfile |