我正在尝试按照非 javascript 教程进行操作,所以我正在尝试从节点脚本运行 webpack,但我遇到了这个奇怪的错误,我在网上搜索过但找不到解决方案
错误:C:\Users\Ahmad Usman\Desktop\9-forkify\webpack.config.js:2 const path = require("path"); ^
下面是代码(虽然它们在不同的文件中)
// INDEX.JS FIle
import num from "./test";
console.log(`num: ${num}`);
// TEST.JS FILE
console.log('imported module');
export default 23;
// PACKAGE.JSON
{
"name": "forkify",
"version": "1.0.0",
"description": "forkify project",
"main": "index.js",
"scripts": {
"dev": "webpack"
},
"author": "Ahmad Usman",
"license": "ISC",
"devDependencies": {
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12"
}
}
//WEBPACK.CONFIG.JS
const path = require("path");
const path = require("path");
module.exports = {
entry: "./src/js/index.js",
output: {
path: path.resolve(__dirname, "dist/js"),
filename: "bundle.js",
},
mode: "development",
};
这是我的命令行界面的 截图 commandline screenshot1
谢谢
宝慕林4294392
相关分类