GithubHelp home page GithubHelp logo

Comments (11)

ai avatar ai commented on June 9, 2024 1

Fixed cdc608f

from size-limit.

ai avatar ai commented on June 9, 2024

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).

  1. Can you take dependencies: { extract-files } and add size-limit.ignore: ["extract-files"] to it? Let’s check that it’s related to ignore.
  2. Can you try "size-limit": "ai/size-limit#ignore-loader" version. I added one possible fix.

from size-limit.

jaydenseric avatar jaydenseric commented on June 9, 2024

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.

ai avatar ai commented on June 9, 2024

Do you have an idea how to change the webpack config to ignore named exports?

from size-limit.

ai avatar ai commented on June 9, 2024

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.

bschlenk avatar bschlenk commented on June 9, 2024

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.

ai avatar ai commented on June 9, 2024

@bschlenk can you show your package.json?

from size-limit.

bschlenk avatar bschlenk commented on June 9, 2024

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.

ai avatar ai commented on June 9, 2024

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.

bschlenk avatar bschlenk commented on June 9, 2024
 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.

ai avatar ai commented on June 9, 2024

Released in 1.3.3

from size-limit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.