-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
It isn't made clear exactly how to use non-javascript webpack configs. #5053
Comments
@webpack-bot move to webpack/webpack.js.org
Add a hint |
I've moved it to webpack/webpack.js.org. |
We should throw an error in this case. |
There is documentation explaining how to do this under Configuration Languages. However, the example given does not actually work!!! I get the following error:
Furthermore, My workaround has been to use the |
I was able to get this to work by simply adding If you're using Finally, My last two points are not related to this issue, but I'm assuming anyone finding this issue from Google is using Webpack to bundle Angular projects. Here is my {
"compilerOptions": {
"target": "es2015",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true
}
} |
I had the same problem. but, I found a solution using tsconfig-path. I submitted a pull request, it merged. And updated the document.Please see docment. |
What if you want to use I've settled on using the |
I'm sorry, I was wrong. I found a solution not use another package.json "scripts": {
"build": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' webpack",
} I'll send new pull request to webpack.js.org for modify docment later. |
I have installed all modules what I need, but still fail to the same error.
My settings is shown below:
|
install ts-node package to make it work
|
TS_NODE_COMPILER_OPTIONS unrecognized command |
version 3.2.0 incorrect work with webpack.config.ts downgrade to 3.1.2 `$ webpack-cli SyntaxError: Unexpected token * |
Downgrade of webpack-cli to 3.1.2 did indeed solve the problem for me. |
The bug is being tracked at webpack/webpack-cli#724 |
I have a similar problem with a custom inline loader. I have an ejected CRA2 app with react-app-rewired.
App.tsx import spec from '!!../webpack/json-schema-ref-loader.ts!../../spec/openapi.yaml';
... It seems that the loader isnt transpiled at all:
I thought it is a problem with compilerOptions.module = 'esnext', but when using require insteadof ES6 import:
I tried various ways to invoke the scripts, but none of them work:
After searching for the wrapping module template, i found only this: webpack/lib/node/NodeMainTemplatePlugin.js Line 164 in 5258471
It seems like loaders arent required like any other module during the webpack process, i wonder why that is? |
|
This issue had no activity for at least three months. It's subject to automatic issue closing if there is no activity in the next 15 days. |
bump |
Issue was closed because of inactivity. If you think this is still a valid issue, please file a new issue with additional information. |
Do you want to request a feature or report a bug?
Feature.
What is the current behavior?
If your webpack.config.* is in a non-javascript language, webpack will very conveniently use an appropriate transpiler to run it, but only if you have all the required packages installed, as listed on the js-interpret extensions map. This would be fine, except for the fact that if you're missing them, it will attempt to read the config as javascript and produce a rather unhelpful error message.
In my case, it looks like this:
This is of course fixed by installing
typescript
andts-node
, as hinted at by the js-interpret documentation, but you might not guess that from this message or the relevant documentation page.If the current behavior is a bug, please provide the steps to reproduce.
Not sure if I'd exactly call it a "bug", but just make a webpack config in a language that isn't javascript and try to run webpack or webpack-dev-server on it and you'll see what I mean.
What is the expected behavior?
It would be very nice if webpack would warn you that you're trying to run a non-js config without the proper tooling installed (just by looking at the extension, for instance), but at the very least this behavior and the proper course of action ought to be mentioned on the Configuration Languages documentation page.
If this is a feature request, what is motivation or use case for changing the behavior?
Right now the documentation doesn't make clear exactly what needs to be done to enable support for non-javascript configuration files, and when you do it incorrectly, webpack gives you no guidance in the right direction. It's entirely up to the user to figure out this somewhat "magic" behavior.
Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.
Webpack 2.6.1, Node 7.1.0, macOS 10.12.4
The text was updated successfully, but these errors were encountered: