我生成了一个JHipster / React应用程序,并将JHipster升级到5.0.1(从5.0.0-beta.1版)并运行 jhipster upgrade 后,运行< em> yarn start :
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应用,但是纱线启动在完全相同的位置失败。
这是 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是否损坏,或者我缺少明显的东西?
答案 0 :(得分:3)
我有同样的问题。使用jhipster info命令,我发现yarn的版本太旧了。我已升级到1.7版。现在,Webpack服务器正在运行。