You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's nice that interpret is used to allow configuration to be written in ES/TS/etc without configuration. However, it is not always desired that a loader hook is automatically registered, and sometimes it can cause a bug.
I think it should be configurable, just as --config-register can be used to register additional hooks, it should be possible to turn off the use of interpret.
What is the current behavior?
When using a configuration with one of the matched filetypes, for example webpack.config.ts, node-interpret registers a loader (e.g. ts-node to be used to transpile the configuration. There is no way to prevent this behaviour except uninstalling the loader (for example uninstalling ts-node. But this is virtually impossible in a larger project - since usually something else will depend on ts-node and cause it to be installed.
To Reproduce
Steps to reproduce the behavior:
Configure webpack using a configuration webpack.config.ts, including using Typescript syntax and types.
Install ts-node in the project
Install tsm in the project, because you want to use esbuild to transpile your scripts and webpack configuration, not ts-node.
run the compilation with node -r tsm $(yarn bin webpack)
There will be type errors, because the following happens:
tsm is registered as a require hook for ts files
ts-node is additionally registered as a require hook for ts files, which I didn't ask for and don't want
The webpack configuration is correctly transpiled to JS by tsm/esbuild
ts-node is incorrectly used to transpile the configuration, but at this point it has already been transpiled. By default, there will be type errors and the compilation will fail. As suggested in Cannot use custom type definitions in webpack.config.ts webpack#13844 (comment), you can work around this by configuring ts-node to skip type checking, but it should not have been used in the first place!
Expected behavior
It should be possible to turn off the use of interpret, so that it does not conflict with the user's intended strategy for transpiling scripts and configuration.
The text was updated successfully, but these errors were encountered:
It's nice that interpret is used to allow configuration to be written in ES/TS/etc without configuration. However, it is not always desired that a loader hook is automatically registered, and sometimes it can cause a bug.
I think it should be configurable, just as
--config-register
can be used to register additional hooks, it should be possible to turn off the use of interpret.What is the current behavior?
When using a configuration with one of the matched filetypes, for example
webpack.config.ts
, node-interpret registers a loader (e.g.ts-node
to be used to transpile the configuration. There is no way to prevent this behaviour except uninstalling the loader (for example uninstallingts-node
. But this is virtually impossible in a larger project - since usually something else will depend on ts-node and cause it to be installed.To Reproduce
Steps to reproduce the behavior:
webpack.config.ts
, including using Typescript syntax and types.ts-node
in the projecttsm
in the project, because you want to use esbuild to transpile your scripts and webpack configuration, not ts-node.node -r tsm $(yarn bin webpack)
There will be type errors, because the following happens:
tsm
is registered as a require hook forts
filests-node
is additionally registered as a require hook forts
files, which I didn't ask for and don't wantts-node
is incorrectly used to transpile the configuration, but at this point it has already been transpiled. By default, there will be type errors and the compilation will fail. As suggested in Cannot use custom type definitions in webpack.config.ts webpack#13844 (comment), you can work around this by configuring ts-node to skip type checking, but it should not have been used in the first place!Expected behavior
It should be possible to turn off the use of
interpret
, so that it does not conflict with the user's intended strategy for transpiling scripts and configuration.The text was updated successfully, but these errors were encountered: