Я пытался запустить свой веб-пакет на моем компьютере с Windows 10.
Я установил веб-пакет в своей корневой папке.
Вот мой webpack.config.js:
const path = require("path");
const SRC_DIR = path.join(__dirname, "/client/src");
const DIST_DIR = path.join(__dirname, "client/dist");
module.exports = {
config: `${SRC_DIR}/index.jsx`,
output: {
filename: `bundle.js`,
path: DIST_DIR
},
module: {
rules: [
{
test: /\.jsx?$/,
include: SRC_DIR,
loader: "babel-loader",
query: {
presets: ["react", "es2015"]
}
}
]
},
mode: "development"
};
А затем внутри моего файла package.json:
{
"name": "rform",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"start": "node server.js",
"build": "webpack --config webpack.config.js"
},
"author": "",
"license": "ISC",
"devDependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^7.1.4",
"babel-preset-es2015": "^6.24.1",
"webpack": "^4.12.0",
"webpack-command": "^0.2.1"
}
}
После запуска npm run build
я получил ffошибка:
ValidationError: config-loader
Options Validation Error
options['config'] is an invalid additional property
at validate (/mnt/c/xampp/htdocs/rform/node_modules/@webpack-contrib/schema-utils/dist/validate-options.js:87:15)
at validator (/mnt/c/xampp/htdocs/rform/node_modules/@webpack-contrib/schema-utils/dist/validate-options.js:118:10)
at resolve.then (/mnt/c/xampp/htdocs/rform/node_modules/@webpack-contrib/config-loader/lib/index.js:18:7)
at process._tickCallback (internal/process/next_tick.js:109:7)
at Module.runMain (module.js:607:11)
at run (bootstrap_node.js:427:7)
at startup (bootstrap_node.js:151:9)
at bootstrap_node.js:542:3
npm ERR! Linux 4.4.0-17134-Microsoft
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "build"
npm ERR! node v7.10.1
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! rform@1.0.0 build: `webpack --config webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the rform@1.0.0 build script 'webpack --config webpack.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the rform package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! webpack --config webpack.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs rform
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls rform
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/darrenchui/.npm/_logs/2018-06-13T07_55_50_484Z-debug.log
Я проверяю, правильно ли я выполняю настройку файла в моей папке dist и src .. Что я делаю неправильно при настройке?Пожалуйста, помогите!