简体   繁体   English

尝试从webpack v1语法切换到webpack v3,并遇到了奇怪的编译错误

[英]Attempted to switch from webpack v1 syntax to webpack v3 and encountered a weird compilation error

I am working on a ReactJS login screen project and first encountered an issue with webpack (re: Compilation Issue with a React Login Screen ) to which @Andrew Li( https://stackoverflow.com/users/5647260/andrew-li ) correctly prompted us switch from Webpack v1 syntax to Webpack v3 syntax. 我正在一个ReactJS登录屏幕项目上工作,首先遇到了webpack的问题(re: React登录屏幕的编译问题 ),@ Andrew Li( https://stackoverflow.com/users/5647260/andrew-li )可以正确地解决这个问题提示我们从Webpack v1语法切换到Webpack v3语法。

This is the resulting config code: 这是生成的配置代码:

https://gist.github.com/jqed-xuereb/8134002fdfb697e34a855e0394969ffc https://gist.github.com/jqed-xuereb/8134002fdfb697e34a855e0394969ffc

Upon compiling and running the code using webpack index.js run.js I get the following error about an unexpected token in a line which doesn't exist in my code. 使用webpack index.js run.js编译并运行代码后,我在代码中不存在的行中收到以下有关意外令牌的以下错误。 Precisely one line under my final line. 正好在我的最后一行之下。 The error: 错误:

 C:\Users\Jake\command line work\LearnD\Iteration 0\app\frontend>webpack 
 index.js run.js
 C:\Users\Jake\command line work\LearnD\Iteration 
 0\app\frontend\webpack.config.js:143
 });
 ^
 SyntaxError: Unexpected token }
  at createScript (vm.js:56:10)
  at Object.runInThisContext (vm.js:97:10)
  at Module._compile (module.js:542:28)
  at Object.Module._extensions..js (module.js:579:10)
  at Module.load (module.js:487:32)
  at tryModuleLoad (module.js:446:12)
  at Function.Module._load (module.js:438:3)
  at Module.require (module.js:497:17)
  at require (internal/module.js:20:19)
  at requireConfig 
(C:\Users\Jake\AppData\Roaming\npm\node_modules\webpack\bin\convert-
argv.js:97:18)

Any form of way pointing or correction regarding the config and getting rid of this error would be more than appreciated. 关于配置的任何形式的方式指向或纠正,以及消除此错误的方法将不胜感激。

Thanks and I owe you virtual pints of beer, 谢谢,我欠您一品脱啤酒,

J. J.

resolve and everything under it should be at the root level not under rules. 解决,其下的所有内容都应该在根源级别,而不是在规则下。 you should add missing ], }, after the last rule 您应该在最后一条规则之后添加缺少的], },

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM