Comments (11)
Fixed cdc608f
from size-limit.
Yeap seems like some sort of conflict between dependency ignore and ES modules.
Thanks for a good issue report. Can I ask you to help me in the investigation? (sorry, need to finish few things on the work before New Year).
- Can you take
dependencies: { extract-files }
and addsize-limit.ignore: ["extract-files"]
to it? Let’s check that it’s related to ignore. - Can you try
"size-limit": "ai/size-limit#ignore-loader"
version. I added one possible fix.
from size-limit.
For (1), it had the same error. So definitely related.
For (2), with this package.json
:
{
"dependencies": {
"extract-files": "^5.0.0"
},
"devDependencies": {
"size-limit": "ai/size-limit#ignore-loader"
},
"scripts": {
"size": "size-limit"
},
"size-limit": [
{
"path": "index.mjs",
"limit": "5 KB",
"ignore": ["extract-files"]
}
]
}
The error is:
ERROR Error:
ERROR in ./index.mjs 1:0-44
"export 'extractFiles' was not found in 'extract-files'
@ multi ./index.mjs
at runWebpack.then.stats ([redacted]/node_modules/size-limit/index.js:217:15)
from size-limit.
Do you have an idea how to change the webpack config to ignore named exports?
from size-limit.
If you have any ideas, you can try to add them here https://github.com/ai/size-limit/blob/master/index.js#L92-L93
Right now I have no idea how to deal with it :(
from size-limit.
I'm running into a similar issue caused by using peerDependencies, but I get a different error Unexpected character '@'
. I'd like to help out with this if I can. Does size-limit output the bundle it is analyzing somewhere? Or is there an easy way to make it do that? The error gives me a line number, but I have no idea how to see the code - being able to see it might help debug it.
from size-limit.
@bschlenk can you show your package.json
?
from size-limit.
I redacted some names, but this is the gist of it. I tried adding "ignore": ["@stuff/my-other-package"]
and that didn't work. Everything is fine if I have @stuff/my-other-package
under dependencies.
I'm using an older version of size-limit in this example, but I get the same error on the latest version, but at different places:
^0.21.0
:at runWebpack.then.stats (/Users/bschlenk/my-package/node_modules/size-limit/index.js:214:15)
^1.3.2
:at getSize (/Users/bschlenk/my-package/node_modules/size-limit/index.js:240:15)
{
"name": "my-package",
"version": "1.0.0",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"test": "jest",
"testWatch": "jest --watch",
"prepublishOnly": "npm run genTypes && npm run compile && npm run size",
"compile": "babel src/*.ts --extensions '.ts' --out-dir ./dist",
"genTypes": "tsc -p build.tsconfig.json",
"size": "size-limit"
},
"dependencies": {
"@babel/runtime": "^7.2.0",
},
"peerDependencies": {
"@stuff/my-other-package": ">= 2.0.0"
},
"devDependencies": {
"@babel/cli": "^7.2.0",
"@babel/core": "^7.2.0",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/plugin-proposal-object-rest-spread": "^7.2.0",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-transform-object-assign": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/preset-env": "^7.2.0",
"@babel/preset-typescript": "^7.1.0",
"@babel/register": "^7.0.0",
"@stuff/my-other-package": "^2.0.0",
"@types/jest": "^23.3.10",
"@types/node": "^10.12.12",
"jest": "^23.6.0",
"size-limit": "^0.21.0",
"ts-jest": "^23.10.5",
"typescript": "^2.7.2"
},
"size-limit": [
{
"path": "dist/index.js",
"limit": "5 KB"
}
]
}
from size-limit.
Thanks. I will look in next few days (sorry, I am preparing conference talk right now).
Can also you show the full error ouput?
from size-limit.
ERROR Error:
ERROR in my-package from Terser
Unexpected character '@' [my-package/index.js:588,17]
at getSize (/Users/bschlenk/my-package/node_modules/size-limit/index.js:240:15)
at <anonymous>
from size-limit.
Released in 1.3.3
from size-limit.
Related Issues (20)
- Should I ignore some file types?
- size-limit fails with rxjs imports
- Add customisation for improving performance culture HOT 6
- Loosen strictness of peer dependency requirement of `tslib` HOT 1
- Global installation with plugin support HOT 5
- React should be peer dependency HOT 7
- The comment might be misleading when size limit fails HOT 5
- Unable to run on windows 10 HOT 4
- Receive ERR_UNSUPPORTED_ESM_URL_SCHEME error on version 10 HOT 5
- Switch from GZIP to Brotli by default HOT 4
- plugins are `import`ed with `require.resolve` which will resolve `commonjs` entry for dual package HOT 4
- Allow customize error message HOT 1
- Inaccurate bundle size when using dynamic imports HOT 10
- Support `.size-limit.mjs` config file HOT 2
- Migrate codebase to TypeScript HOT 4
- Esbuild plugin produces incorrect numbers when CSS used HOT 7
- Extra blank lines when using --silent HOT 1
- CLI does not work with workspaces and yarn pnp or pnpm without hoisting HOT 4
- Can the config option be supported like eslint or stylelint to specify the path of the configuration file? HOT 1
- size-limit fails to detect paths/files containing unescaped characters HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from size-limit.