繁体   English   中英

Webpack / Babel 错误:模块构建失败:(SystemJS)ENOENT:没有这样的文件或目录

[英]Webpack / Babel Error: Module build failed: (SystemJS) ENOENT: no such file or directory

如果有人可以提供一些建议,我正在寻找运行 webpack 时出现以下错误的帮助。 在我看来,所使用的路径是 develop/babel-core 而不是 develop/node_modules/babe-core 但我在这里可能不合时宜。 Webpack 和 Babel 使用的是最新版本。

ERROR in ./js/scripts.js Module build failed: (SystemJS) ENOENT: no such file or directory, open
'/Users/dh/Documents/Websites/www.mpp.dev/wp-content/themes/develop/babel-core'
Error: ENOENT: no such file or directory, open
'/Users/dh/Documents/Websites/www.mpp.dev/wp-content/themes/develop/babel-core'

Error loading
/Users/dh/Documents/Websites/www.mpp.dev/wp-content/themes/develop/babel-core
as "babel-core" from
/Users/dh/Documents/Websites/www.mpp.dev/wp-content/themes/develop/node_modules/babel-loader/lib/index.js

ERROR in ./js/admin.js Module build failed: (SystemJS) ENOENT: no such
file or directory, open
'/Users/dh/Documents/Websites/www.mpp.dev/wp-content/themes/develop/babel-core'
Error: ENOENT: no such file or directory, open
'/Users/dh/Documents/Websites/www.mpp.dev/wp-content/themes/develop/babel-core'

Error loading
/Users/dh/Documents/Websites/www.mpp.dev/wp-content/themes/develop/babel-core
as "babel-core" from
/Users/dh/Documents/Websites/www.mpp.dev/wp-content/themes/develop/node_modules/babel-loader/lib/index.js

这是我的配置,我认为语法是正确的。

module.exports = {
    entry: {
        scripts: './js/scripts.js',
        admin: './js/admin.js',
    },
    output: {
        filename: 'build/js/[name].js',
        chunkFilename: 'build/js/[id].js'
    },
        module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /(node_modules)/,
                use: {                                                                                                          loader: 'babel-loader',
        options: {
            presets: ['env']
        },                                                                      },
                }
            }
        ]
    }
}

提前致谢...

我遇到了与/node_modules/babe-core not found 类似的问题,我通过以下方式解决了:

npm install postcss-import@8.0.2 --save-dev

参见: babel-loader#242

暂无
暂无

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

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