[英]gulp-webpack error: Entry module not found: Error: cannot resolve module
When I try gulp scipts, it throws me the following error当我尝试 gulp scipts 时,它会抛出以下错误
ERROR in Entry module not found:未找到输入模块中的错误:
Error: Can't resolve 'C:/Users/milan/Local Sites/project-university/app/public/wp-content/themes/fictional-university-theme/js/scripts.js' in 'C:\\Users\\milan\\Local Sites\\project-university\\app\\public'
错误:无法解析“C:\\Users\\”中的“C:/Users/milan/Local Sites/project-university/app/public/wp-content/themes/fictional-university-theme/js/scripts.js”米兰\\本地站点\\project-university\\app\\public'
below is my webpack.config.js下面是我的webpack.config.js
const path = require('path'), settings = require('./settings'); module.exports = { entry: { App: settings.themeLocation + "js/scripts.js" }, output: { path: path.resolve(__dirname, settings.themeLocation + "js"), filename: "scripts-bundled.js" }, module: { rules: [ { test: /\\.js$/, exclude: /node_modules/, use: { loader: 'babel-loader', options: { presets: ['@babel/preset-env'] } } } ] }, mode: 'development' }
and my settings.js :和我的settings.js :
exports.urlToPreview = 'http://project-university.local/'; exports.themeLocation = 'C:/Users/milan/Local Sites/project-university/app/public/wp-content/themes/fictional-university-theme/';
Below is my file directory,下面是我的文件目录,
Project---- app------ public----------(wordpress content files)项目---- app------ public---------(wordpress 内容文件)
The problem is the compiling path defined in settings.js
.问题在于
settings.js
定义的编译路径。 Change the defined path from更改定义的路径
exports.themeLocation = './public/wp-content/themes/fictional-university-theme/';
to到
exports.themeLocation = './wp-content/themes/fictional-university-theme/';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.