Open Panoplos opened 7 years ago
Could you put this plugin in babelrc ?(with env switch options )
not sure your babel-register
works.
The plugin works in babelrc, but this is not ideal. When you mention that you are not sure if my babel-register
works, what do you mean? It is working for all other babel related polyfills, like es6 modules.
Works in babelrc
, means this is not an issue for this plugin.
May some issue with babel-register
, could you provide an mini repo for reproducing this issue.
BTW, don't suggest use babel-register
in production, compile codes before deploying.
require hook is not stable.
Not sure I said anything about production mode. I am using webpack for server build and will rely on this plugin in the webpack config. Anyway, it was advertised that this works with the babel register hook, which it didn't, so I thought I would report the issue. Setting up a repo for reproduction of this is not something I have the time for, sorry.
That said, here are my software versions, for your reference:
node: v7.10.1 babel-core: 6.24.1 babel-register: 6.24.1 babel-loader: 7.1.1 babel-preset-env: 1.6.0 babel-plugin-transform-require-ignore: 0.1.1
babel-register
uses for runtime,like testing in node. If you put this in code, that means you have to use this in production or other environments
.
it is not for compiling code.
For webpack user, you can use the first case in ReadMe of repo home.
And run BABEL_ENV=node babel
to make this plugin enabled only for node
Again, I am not using the above entry script in the webpack build. Just for running the server in dev mode. I have a specific webpack config for building the server that does not use babel-register, as it polyfills via other means.
I have a server that is performing SSR on a React App that uses less-loader in the webpack build of the app. When serving in production, SSR fails on the less import statements as I am not using webpack to initialise the server...which is why I tried your plugin.
The server is started with the following script:
However, I am still getting
My
.babelrc
looks like this: