tern icon indicating copy to clipboard operation
tern copied to clipboard

Allow for webpack resolve configs to be passed directly

Open eloytoro opened this issue 8 years ago • 5 comments

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

eloytoro avatar May 18 '17 19:05 eloytoro

Note: allowing to compile the config using babel-register adds a noticeable delay to server startup

eloytoro avatar May 18 '17 19:05 eloytoro

Until this is merged, is there a good workaround?

tyrocca avatar Jun 05 '17 18:06 tyrocca

@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

eloytoro avatar Jun 05 '17 19:06 eloytoro

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.

chemzqm avatar Jun 14 '17 06:06 chemzqm

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 .

eloytoro avatar Jun 15 '17 06:06 eloytoro