Home  >  Article  >  Web Front-end  >  What should I do if fs reports an error when webpack packages node?

What should I do if fs reports an error when webpack packages node?

藏色散人
藏色散人Original
2022-12-29 15:08:013099browse

Solution to the fs error when webpack packages node: 1. Install the babel packaging tool in the Webpack project; 2. Check the packaging failure information; 3. Directly uninstall the original Nodejs and re-download the stable Node version; 4. Use prefetch to cache the js modules to be used in advance.

What should I do if fs reports an error when webpack packages node?

#The operating environment of this tutorial: Windows 10 system, node v10.16.0 version, Dell G3 computer.

What should I do if fs reports an error when webpack packages node?

Webpack problem record solutionError: Cannot find module 'node:fs/promises'

Project scenario:

After installing the babel packaging tool in the Webpack project, the packaging failed and Error: Cannot find module ' node:fs/promises'

ERROR in ./src/index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):Error: Cannot find module 'node:fs/promises'

Solution:

I tried many solutions on the Internet and said cnpm The wrong version, etc., but to no avail.
Final solution: Just uninstall the original Nodejs and download the latest stable Node version to solve the problem.

What should I do if fs reports an error when webpack packages node?

What should I do if fs reports an error when webpack packages node?

[webpack-cli] Error: Conflict: Multiple chunks emit assets to the same filename main.js (chunks main and vendors-node_modules_core-js_modules_es6_function_bind_js-node_modules_core-js_modules_es6_ob-dc6264)

Conflict: Multiple chunks Send assets to the same file name main.js
Change the output filename to Automatically modify by name.

output: {
    path: path.join(__dirname, '../dist'),
    filename: '[name].js'},

Use prefetch to cache the js module to be used in advance.
What should I do if fs reports an error when webpack packages node?

Show prefetch catch.
What should I do if fs reports an error when webpack packages node?Recommended learning: "node.js Video Tutorial"

The above is the detailed content of What should I do if fs reports an error when webpack packages node?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn