tern
tern copied to clipboard
Allow for webpack resolve configs to be passed directly
Right now term supports passing the configPath and the modules options to the webpack plugin.
As it so happens, webpack 2 natively supports configs to be written using ES6 modules because it transpiles the config using babel if it has the .babel.js termination.
There are two ways to solve this as far as I can see.
- Add babel-core as a dependency to tern
- Allow to pass the values directly to the config
The first solution is the best one for users in my opinion, being able to require their babel-esque config would silently fix the issue. If you guys like it we can close this PR and I can open another one that takes care of this.
The second solution is what I'm doing here, allowing to pass "alias" to the config should fix the issue for now
Note: allowing to compile the config using babel-register adds a noticeable delay to server startup
Until this is merged, is there a good workaround?
@tyrocca the only work around would be to not use babel for the webpack config so it can be required directly as a node module
Another workaround is to make tern read .babel.js and use the babel module from the project to compile the config file before load, so no need for add babel-core as a dependency to tern.
The tern command isn't necessarily executed in the directory where the project is, so I'm not sure that requiring local dependencies could be feasible.
Still waiting on a maintainer for a response
On Jun 14, 2017 8:05 AM, "Qiming zhao" [email protected] wrote:
Another workaround is to make tern read .babel.js and use the babel module from the project to compile the config file before load, so no need for add babel-core as a dependency to tern.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ternjs/tern/pull/908#issuecomment-308328564, or mute the thread https://github.com/notifications/unsubscribe-auth/ADwSBckZI0dVYjcwAgZ0r7gIHmfgT37Jks5sD3gggaJpZM4NfqNP .