-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
core: transpile minimum node_modules #10725
Conversation
@@ -25,7 +25,16 @@ const projectRoot = () => { | |||
|
|||
export const includePaths = [projectRoot()]; | |||
export const nodeModulesPaths = path.resolve('./node_modules'); | |||
export const excludePaths = [/node_modules/]; | |||
|
|||
// Run `npx are-you-es5 check lib/core -r` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How long does it take to run this command, could we potentially run it before running storybook on the user's machine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's pretty quick but it's only CLI and the output is as follow
$ npx are-you-es5 check lib/core -r
npx : 4 installé(s) en 2.09s
❌ @storybook/node-logger is not ES5
was found
❌ better-opn is not ES5
❌ boxen is not ES5
❌ chalk is not ES5
❌ commander is not ES5
❌ find-cache-dir is not ES5
❌ find-up is not ES5
❌ fs-extra is not ES5
❌ json5 is not ES5
❌ node-fetch is not ES5
❌ pkg-dir is not ES5
as found
❌ resolve-from is not ES5
❌ semver is not ES5
Babel-loader exclude regex:
/[\/]node_modules[\/] (?!(@storybook/node-logger|better-opn|boxen|chalk|commander|find-cache-dir|find-up|fs-extra|json5|node-fetch|pkg-dir|resolve-from|semver)[\/])/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it's expensive, we should make it easier to update this code using a script?
// Run `npx are-you-es5 check lib/core -r` | ||
// to get this regexp | ||
export const excludePaths = [ | ||
/[\\/]node_modules[\\/](?!(@storybook\/node-logger|are-you-es5|better-opn|boxen|chalk|commander|find-cache-dir|find-up|fs-extra|json5|node-fetch|pkg-dir|resolve-from|semver)[\\/])/, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is @storybook/node-logger
in this list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I unfortunately don't know. I was surprised as well but also didn't wanted to alter the output of the regexp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it only is run in node, and so ES6 is fine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should not be bundled into client-code ever
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
being in this regexp doesn't mean you'll get bundled. It's only "If you're being bundled and going though babel, you'll get transpiled"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
of course, the are-you-es5
just detects the code being ES6 and adds it to the list.
Can't reproduce CLI error locally, can someone try on a mac ? :( |
/[\\/]node_modules[\\/](?!(@storybook\/node-logger|are-you-es5|better-opn|boxen|chalk|commander|find-cache-dir|find-up|fs-extra|json5|node-fetch|pkg-dir|resolve-from|semver)[\\/])/, | ||
// Never transpile again the following: | ||
/[\\/]node_modules[\\/]webpack/, | ||
/[\\/]node_modules[\\/]core-js/, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mrmckeb @gaetanmaisse what does this mean for yarn 2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing the include will not match anything in yarn2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @gaetanmaisse once said:
it will not be worse than what we have today
], | ||
require.resolve('babel-plugin-macros'), | ||
...plugins, | ||
// Shoud only be done on manager to to ember |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain? why not always?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
All theses deps have been used in `@storybook/core` in #10725 But haven't been properly added as dependencies.
All theses deps have been used in `@storybook/core` in #10725 But haven't been properly added as dependencies.
Issue: Famous IE 11 #10674 #10670 #10486
What I did
Transpile minimum node_modules.
This is a slighlty different approach than #10683.
How to test