【发布时间】:2018-06-26 19:00:28
【问题描述】:
我已经生成了一个 JHipster / React 应用程序,在将 JHipster 升级到 5.0.1(从 5.0.0-beta.1)并运行 jhipster upgrade 后,我在运行时得到以下信息 纱线开始:
WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/concepts/mode/
ERROR in multi (webpack)-dev-server/client?http://localhost:8081 ./src
Module not found: Error: Can't resolve './src' in '/Users/yvon/git/ods-jhipster-sns'
@ multi (webpack)-dev-server/client?http://localhost:8081 ./src
ℹ 「wdm」: Failed to compile.
我尝试使用 5.0.1 生成器生成分支新 jhipster 应用程序,但 yarn start 在完全相同的位置失败。
这是 package.json 的相关部分:
"scripts": {
"precommit": "lint-staged",
"prettier:format": "yarn prettier --write 'src/**/*.{ts,tsx,css,scss}'",
"lint": "tslint --project tsconfig.json -e 'node_modules/**'",
"lint:fix": "yarn run lint --fix",
"cleanup": "rimraf target/www",
"start": "yarn run webpack:dev",
"test": "yarn run lint && jest --coverage --logHeapUsage -w=2 --config src/test/javascript/jest.conf.js",
"test:watch": "yarn test --watch",
"webpack:dev": "yarn run webpack-dev-server --config webpack/webpack.dev.js --progress --inline --profile --port=9060",
"webpack:build:main": "yarn run webpack --config webpack/webpack.dev.js --progress --profile",
"webpack:build": "yarn run cleanup && yarn run webpack:build:main",
"webpack:prod:main": "yarn run webpack --config webpack/webpack.prod.js --profile",
"webpack:prod": "yarn run cleanup && yarn run webpack:prod:main",
"webpack:test": "yarn run test",
"webpack-dev-server": "node --max_old_space_size=4096 node_modules/webpack-dev-server/bin/webpack-dev-server.js",
"webpack": "node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js"},
和webpack-dev.js:
const webpack = require('webpack');
const writeFilePlugin = require('write-file-webpack-plugin');
const webpackMerge = require('webpack-merge');
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
const WebpackNotifierPlugin = require('webpack-notifier');
const path = require('path');
const utils = require('./utils.js');
const commonConfig = require('./webpack.common.js');
const ENV = 'development';
module.exports = webpackMerge(commonConfig({ env: ENV }), {
devtool: 'cheap-module-source-map', // https://reactjs.org/docs/cross-origin-errors.html
mode: 'development',
entry: [
'react-hot-loader/patch',
'./src/main/webapp/app/index'
],
是 JHipster/React 5.0.1 坏了,还是我遗漏了一些明显的东西?
【问题讨论】:
标签: webpack jhipster webpack-dev-server