-
-
Notifications
You must be signed in to change notification settings - Fork 622
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
webpack.config.ts
can not be resolved any more after upgrading to 3.2.0
#724
Comments
Checking it out. |
can you make a repro repo for me to make it easier to debug? |
Not specific to typescript, we have the same problem with webpack.config.babel.js. Downgrading webpack-cli to 3.1.2 fixes this |
Gotcha. I think that we will need to add |
fix(bin): extension detection (#724)
Looks like this was fixed in the 3.2.1 release. |
@JounQin if you think the your problem is fixed, feel free to close the issue! |
FYI: it's fixed for |
Thanks. |
Still getting this error
|
I have the same problem
|
Could you try |
|
typescript, webpack-cli and webpack should be installed locally. Maybe I'm doing something wrong? |
I think it is still broken: webpack-cli@3.2.3 It is monorepo with hoisted node_modules. webpack --config webpack.prod.ts
xxxxxxxxxxxxxxxxx/node_modules/@babel/parser/lib/index.js:3831
const err = new SyntaxError(message);
^
SyntaxError: xxxxxxxxxxxxxxxxx/clients/web/webpack.prod.ts: Unexpected token (14:12)
12 | const extractGlobal = new ExtractTextPlugin("css/global.css");
13 |
> 14 | const config: webpack.Configuration = {
| ^
15 | mode: "production",
16 | /**
17 | * Type of sourceMaps
at Parser.raise (xxxxxxxxxxxxxxxxx/node_modules/@babel/parser/lib/index.js:3831:17)
at Parser.unexpected (xxxxxxxxxxxxxxxxx/node_modules/@babel/parser/lib/index.js:5143:16)
at Parser.parseVar (xxxxxxxxxxxxxxxxx/node_modules/@babel/parser/lib/index.js:7884:18)
at Parser.parseVarStatement (xxxxxxxxxxxxxxxxx/node_modules/@babel/parser/lib/index.js:7714:10)
at Parser.parseStatementContent (xxxxxxxxxxxxxxxxx/node_modules/@babel/parser/lib/index.js:7310:21)
at Parser.parseStatement (xxxxxxxxxxxxxxxxx/node_modules/@babel/parser/lib/index.js:7243:17)
at Parser.parseBlockOrModuleBlockBody (xxxxxxxxxxxxxxxxx/node_modules/@babel/parser/lib/index.js:7810:25)
at Parser.parseBlockBody (xxxxxxxxxxxxxxxxx/node_modules/@babel/parser/lib/index.js:7797:10)
at Parser.parseTopLevel (xxxxxxxxxxxxxxxxx/node_modules/@babel/parser/lib/index.js:7181:10)
at Parser.parse (xxxxxxxxxxxxxxxxx/node_modules/@babel/parser/lib/index.js:8660:17)
at parse (xxxxxxxxxxxxxxxxx/node_modules/@babel/parser/lib/index.js:10660:38)
at parser (xxxxxxxxxxxxxxxxx/node_modules/@babel/core/lib/transformation/normalize-file.js:170:34)
at normalizeFile (xxxxxxxxxxxxxxxxx/node_modules/@babel/core/lib/transformation/normalize-file.js:138:11)
at runSync (xxxxxxxxxxxxxxxxx/node_modules/@babel/core/lib/transformation/index.js:44:43)
at transformSync (xxxxxxxxxxxxxxxxx/node_modules/@babel/core/lib/transform.js:43:38)
at Object.transform (xxxxxxxxxxxxxxxxx/node_modules/@babel/core/lib/transform.js:22:38)
at compile (xxxxxxxxxxxxxxxxx/node_modules/@babel/register/lib/node.js:73:20)
at compileHook (xxxxxxxxxxxxxxxxx/node_modules/@babel/register/lib/node.js:102:12)
at Module._compile (xxxxxxxxxxxxxxxxx/node_modules/pirates/lib/index.js:93:29)
at Module._extensions..js (internal/modules/cjs/loader.js:745:10)
at Object.newLoader [as .ts] (xxxxxxxxxxxxxxxxx/node_modules/pirates/lib/index.js:104:7)
at Module.load (internal/modules/cjs/loader.js:626:32)
at tryModuleLoad (internal/modules/cjs/loader.js:566:12)
at Function.Module._load (internal/modules/cjs/loader.js:558:3)
at Module.require (internal/modules/cjs/loader.js:663:17)
at require (xxxxxxxxxxxxxxxxx/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at WEBPACK_OPTIONS (xxxxxxxxxxxxxxxxx/node_modules/webpack-cli/bin/convert-argv.js:116:13)
at requireConfig (xxxxxxxxxxxxxxxxx/node_modules/webpack-cli/bin/convert-argv.js:118:6)
at xxxxxxxxxxxxxxxxx/node_modules/webpack-cli/bin/convert-argv.js:126:17
at Array.forEach (<anonymous>)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @0.0.1 build: `webpack --config webpack.prod.ts`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @0.0.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: |
I found it. In my case adding typescript project references broke build not webapck cli. I am not sure why adding references affected parsing of webpack config... |
I was having the same issue above ( |
I have the same issue for the following versions
and it worked after adding tihs:
|
我的也有同样问题,执行 {
"name": "angular-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "webpack"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@types/node": "^12.7.4",
"@types/webpack": "^4.39.1",
"ts-node": "^8.3.0",
"tsconfig-paths": "^3.8.0",
"typescript": "^3.6.2",
"webpack-cli": "^3.3.7"
}
} |
Try updating to 3.3.8 |
I ran into this problem when trying to use the following "module": "esnext", As @hakobpogh said above, if you specify a different
"build": "export TS_NODE_PROJECT=toolchain/tsconfig.webpack.json && webpack --config toolchain/webpack.config.ts",
"module": "commonjs",
"module": "esnext", <-- or whatever else you want for your project's source files. |
Describe the bug
As Title.
What is the current behavior?
To Reproduce
Steps to reproduce the behavior:
use
webpack.config.ts
withts-node
Expected behavior
build successfully
The text was updated successfully, but these errors were encountered: