当我尝试gulp scipts时,会引发以下错误
在输入模块中找不到错误:
错误:无法解析'C:/ Users / milan / Local 网站/project-university/app/public/wp-content/themes/fictional-university-theme/js/scripts.js' 在“ C:\ Users \ milan \ Local Sites \ project-university \ app \ public”
下面是我的 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'
}
和我的 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/';
下面是我的文件目录,
Project ---- app ------ public ----------(wordpress内容文件)
答案 0 :(得分:0)
问题是在settings.js
中定义的编译路径。将定义的路径更改为
exports.themeLocation = './public/wp-content/themes/fictional-university-theme/';
到
exports.themeLocation = './wp-content/themes/fictional-university-theme/';