报错File was processed with these loaders: You may need an additional loader to handle the result...

Error screenshot:

insert image description here

Error message:

Module parse failed: Unexpected token (16:9)
File was processed with these loaders:
./node_modules/cache-loader/dist/cjs.js *
./node_modules/babel-loader/lib/index.js *
./node_modules/eslint-loader/index.js
You may need an additional loader to handle the result of these loaders.
| } from ‘@/api/util’;
| export * from ‘./modules/demo’;
export * as openPlatform from ‘./modules/openPlatform’;
| export * as appStore from ‘./modules/appStore’;
| export * as networkElement from ‘./modules/networkElement’;

Problem statement:


For the vue2 project, after npm install, npm run dev runs the project, and the error is reported as above.
I have been looking at this problem for a day. . . . . . . . . . . .

At the beginning, I kept searching for error messages, and all the results from Baidu were to configure webpack, add vue-loader, etc., but it has not been able to solve the problem.

Insert a sentence here ( emphasis!!! ):
If your error message is similar to this:

File was processed with these loaders:
  XXXX......
 You may need an additional loader to handle the result of these loaders.

Then your error message must point to vuea file or csscode under these two sentences , then you can rest assured that like most search answers, configurewebpack

If it points to the js code like my screenshot , then there is something wrong with your js code! ! ! , I didn't notice at first whoop whoop

problem solved:


The code in my js file above is like this

export * as openPlatform from ‘./modules/openPlatform’; 
export * as appStore from ‘./modules/appStore’;
export * as networkElement from ‘./modules/networkElement’;

Before Webpack 5, this kind Webpackof export * as name1 from …export syntax was not supported, and my webpackversion was 4+, so it caused an error

Change it to the following:

import * as test from './test.js';
export {
    
     test }

over~

Guess you like

Origin blog.csdn.net/weixin_52443895/article/details/131802448