Webpack ModuleParseError: Unexpected Token in FontIcon.less - 解决方法
{"title":"[INFO] ERROR in ./src/components/Icon/FontIcon.less\n[INFO] Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):\n[INFO] ModuleParseError: Module parse failed: Unexpected token (1:0)\n[INFO] You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders\n[INFO] > \n[INFO] | <!--\n[INFO] |\n[INFO] at handleParseError (D:\Code\gitx\dremio\dac\ui\node_modules\webpack\lib\NormalModule.js:976:19)\n[INFO] at D:\Code\gitx\dremio\dac\ui\node_modules\webpack\lib\NormalModule.js:1095:5\n[INFO] at processResult (D:\Code\gitx\dremio\dac\ui\node_modules\webpack\lib\NormalModule.js:800:11)\n[INFO] at D:\Code\gitx\dremio\dac\ui\node_modules\webpack\lib\NormalModule.js:860:5\n[INFO] at D:\Code\gitx\dremio\dac\ui\node_modules\loader-runner\lib\LoaderRunner.js:407:3\n[INFO] at iterateNormalLoaders (D:\Code\gitx\dremio\dac\ui\node_modules\loader-runner\lib\LoaderRunner.js:233:10)\n[INFO] at D:\Code\gitx\dremio\dac\ui\node_modules\loader-runner\lib\LoaderRunner.js:224:4\n[INFO] at D:\Code\gitx\dremio\dac\ui\node_modules\webpack\lib\NormalModule.js:834:15\n[INFO] at eval (eval at create (D:\Code\gitx\dremio\dac\ui\node_modules\tapable\lib\HookCodeFactory.js:33:10), javascript\nmodule: {\n rules: [\n {\n test: /.less$/,\n use: [\n 'style-loader',\n 'css-loader',\n 'less-loader'\n ]\n }\n ]\n}\n\n\n这样就会为.less文件配置一个处理器,并且webpack将能够正确解析和处理这些文件。重新运行webpack构建命令后,该错误应该就会被修复。
原文地址: https://www.cveoy.top/t/topic/nayH 著作权归作者所有。请勿转载和采集!