Skip to content
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

Upgrade to esbuild 0.18 #923

Closed
ndelangen opened this issue Jun 12, 2023 · 2 comments
Closed

Upgrade to esbuild 0.18 #923

ndelangen opened this issue Jun 12, 2023 · 2 comments

Comments

@ndelangen
Copy link

I'm trying to upgrade storybook to esbuild 0.18, but it seems tsup is not yet on 0.18 and it seems like it's conflicting?

PR:
storybookjs/storybook#23017

CI:
https://app.circleci.com/pipelines/github/storybookjs/storybook/51851/workflows/fb87aa28-faf5-47cf-87ff-274987eb1c05/jobs/540940

LOG:

> nx run @storybook/vue3:prep --reset --optimized

RollupError: Unexpected token (Note that you need plugins to import files that are not JavaScript)
    at error (/tmp/storybook/scripts/node_modules/rollup/dist/shared/rollup.js:284:30)
    at Module.error (/tmp/storybook/scripts/node_modules/rollup/dist/shared/rollup.js:14009:16)
    at Module.tryParse (/tmp/storybook/scripts/node_modules/rollup/dist/shared/rollup.js:14730:25)
    at Module.setSource (/tmp/storybook/scripts/node_modules/rollup/dist/shared/rollup.js:14332:39)
    at ModuleLoader.addModuleSource (/tmp/storybook/scripts/node_modules/rollup/dist/shared/rollup.js:24328:20)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

I've been tracing what's causing this failure and was able to get a bit more information out:

{
  cause: SyntaxError: Unexpected token (20:22447)
      at Object.pp$4.raise (/Users/me/Projects/Storybook/core/scripts/node_modules/rollup/dist/shared/rollup.js:21736:13)
      at Object.pp$9.unexpected (/Users/me/Projects/Storybook/core/scripts/node_modules/rollup/dist/shared/rollup.js:19035:8)
      at Object.pp$5.parseIdent (/Users/me/Projects/Storybook/core/scripts/node_modules/rollup/dist/shared/rollup.js:21667:10)
      at Object.pp$5.parsePropertyName (/Users/me/Projects/Storybook/core/scripts/node_modules/rollup/dist/shared/rollup.js:21470:109)
      at Object.pp$5.parseProperty (/Users/me/Projects/Storybook/core/scripts/node_modules/rollup/dist/shared/rollup.js:21396:8)
      at Object.pp$5.parseObj (/Users/me/Projects/Storybook/core/scripts/node_modules/rollup/dist/shared/rollup.js:21359:21)
      at Object.pp$5.parseExprAtom (/Users/me/Projects/Storybook/core/scripts/node_modules/rollup/dist/shared/rollup.js:21094:17)
      at Object.pp$5.parseExprSubscripts (/Users/me/Projects/Storybook/core/scripts/node_modules/rollup/dist/shared/rollup.js:20910:19)
      at Object.pp$5.parseMaybeUnary (/Users/me/Projects/Storybook/core/scripts/node_modules/rollup/dist/shared/rollup.js:20876:17)
      at Object.pp$5.parseExprOps (/Users/me/Projects/Storybook/core/scripts/node_modules/rollup/dist/shared/rollup.js:20803:19) {
    pos: 146699,
    loc: Position { line: 20, column: 22447 },
    raisedAt: 146700
  },
  code: 'PARSE_ERROR',
  id: '/Users/me/Projects/Storybook/core/code/renderers/vue3/dist/config.mjs',
  message: 'Unexpected token (Note that you need plugins to import files that are not JavaScript)'
}
RollupError: Unexpected token (Note that you need plugins to import files that are not JavaScript)
    at error (/Users/me/Projects/Storybook/core/scripts/node_modules/rollup/dist/shared/rollup.js:284:30)
    at Module.error (/Users/me/Projects/Storybook/core/scripts/node_modules/rollup/dist/shared/rollup.js:14009:16)
    at Module.tryParse (/Users/me/Projects/Storybook/core/scripts/node_modules/rollup/dist/shared/rollup.js:14732:25)
    at Module.setSource (/Users/me/Projects/Storybook/core/scripts/node_modules/rollup/dist/shared/rollup.js:14332:39)
    at ModuleLoader.addModuleSource (/Users/me/Projects/Storybook/core/scripts/node_modules/rollup/dist/shared/rollup.js:24332:20)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

I was able to print the this.input rollup is interacting on, and found it's breaking here:
Screenshot 2023-06-12 at 09 49 55

which if i don't optimize whitespace looks like:
Screenshot 2023-06-12 at 10 01 53

And this function seems to be used inside runInContext of lodash.. what a rabbit hole.

I'm hoping upgrading tsup will just resolve some version conflict..

@ndelangen
Copy link
Author

ndelangen commented Jun 12, 2023

edit, I'm digging in deeper..

I've externalized lodash (bundling it was a mistake, I guess).

Now I'm running into this bit of code that's generated, that seems invalid:

var PatchFlagNames = {
  1: "TEXT",
  2: "CLASS",
  4: "STYLE",
  8: "PROPS",
  16: "FULL_PROPS",
  32: "HYDRATE_EVENTS",
  64: "STABLE_FRAGMENT",
  128: "KEYED_FRAGMENT",
  256: "UNKEYED_FRAGMENT",
  512: "NEED_PATCH",
  1024: "DYNAMIC_SLOTS",
  2048: "DEV_ROOT_FRAGMENT",
  -1: "HOISTED",
  -2: "BAIL"
};

Which is coming from here:
https://github.com/vuejs/core/blob/main/packages/shared/src/patchFlags.ts

@ndelangen
Copy link
Author

Ok, after digging deeper and deeper, I found a solution.

I'll close this issue, but would still appreciate a bump of dependencies including esbuild let me know if I can help @egoist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant