[英]gulp-webpack error: Entry module not found: Error: cannot resolve module
當我嘗試 gulp scipts 時,它會拋出以下錯誤
未找到輸入模塊中的錯誤:
錯誤:無法解析“C:\\Users\\”中的“C:/Users/milan/Local Sites/project-university/app/public/wp-content/themes/fictional-university-theme/js/scripts.js”米蘭\\本地站點\\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/';
下面是我的文件目錄,
項目---- app------ public---------(wordpress 內容文件)
問題在於settings.js
定義的編譯路徑。 更改定義的路徑
exports.themeLocation = './public/wp-content/themes/fictional-university-theme/';
到
exports.themeLocation = './wp-content/themes/fictional-university-theme/';
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.