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

[ENHANCEMENT]: Update interpret to 2.0 (to have upward-optional for babel 7.0) #1107

Closed
ilan-schemoul opened this issue Oct 31, 2019 · 3 comments

Comments

@ilan-schemoul
Copy link

Babel 7 now has a scope for the files it compiles which is determined by package.json.
I'll give my project as an example :

App/
  Client/
     Components/ 
      ...
      .babelrc
      package.json
      webpack.config.babel.js
   helpers/
      settings.js
  package.json

webpack.config.babel.js imports a file from outside /client "../helpers/settings.js"
With babel 6 it was okay, with babel 7 @babel/register must set "mode" to "upward-optional" (or upward) if you want babel to transpile files outside its root (which is determined by package.json).
So in my case importing a file outside from "client"

What is the expected behavior?
Being able to import from outside a folder with a package.json with babel 7.0
What is motivation or use case for adding/changing the behavior?
Babel 7 changed the behaviour, one needs to use upwad-optional/upward for babel 7.
How should this be implemented in your opinion?
Update to interpret to 2.0 (my PR brought upward-option for babel register of babel 7.0 gulpjs/interpret#58)

Are you willing to work on this yourself?
yes

@sokra sokra transferred this issue from webpack/webpack Nov 4, 2019
@evenstensberg
Copy link
Member

Could you submit a PR?

@evenstensberg evenstensberg changed the title Update interpret to 2.0 (to have upward-optional for babel 7.0) [ENHANCEMENT]: Update interpret to 2.0 (to have upward-optional for babel 7.0) Nov 6, 2019
@ilan-schemoul
Copy link
Author

ilan-schemoul commented Dec 19, 2019

215e233a updated the interpret. I don't see a release yet so I'm going to test against the next branch to test if I can finally do what I wanted to do (which mean use ESNext syntax like import/export in files imported from babel config files)

@ilan-schemoul
Copy link
Author

ilan-schemoul commented Dec 19, 2019

Even installing webpack-cli from github, what I want to do still does not work. If I import from client/webpack.config.babel.js a file from outside client it won't parse the ES6 syntax through babel so export and import will fail.

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

No branches or pull requests

2 participants