尝试安装和更新我已经有一段时间了。最后,所有npm软件包均为最新版本。您能告诉我如何克服此阻止错误吗?
[ERROR] ERROR in multi react-hot-loader/patch event-source-polyfill webpack-hot-middleware/client?path=__webpack_hmr&dynamicPublicPath=true ./ClientApp/boot.tsx
Module not found: Error: Can't resolve 'react-hot-loader/webpack' in '...'
@ multi react-hot-loader/patch event-source-polyfill webpack-hot-middleware/client?path=__webpack_hmr&dynamicPublicPath=true ./ClientApp/boot.tsx
这是我的webpack.config.js:
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin;
const bundleOutputDir = './wwwroot/dist';
module.exports = (env) => {
const isDevBuild = !(env && env.prod);
return [{
stats: { modules: false },
entry: { 'main': './ClientApp/boot.tsx' },
resolve: { extensions: ['.js', '.jsx', '.ts', '.tsx'] },
output: {
path: path.join(__dirname, bundleOutputDir),
filename: '[name].js',
publicPath: 'dist/'
},
module: {
rules: [
{ test: /\.tsx?$/, include: /ClientApp/, use: 'awesome-typescript-loader?silent=true' },
{ test: /\.css$/, use: isDevBuild ? ['style-loader', 'css-loader'] : ExtractTextPlugin.extract({ use: 'css-loader?minimize' }) },
{ test: /\.(png|jpg|jpeg|gif|svg)$/, use: 'url-loader?limit=25000' },
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "url-loader"
},
{
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "url-loader"
}
]
},
plugins: [
new CheckerPlugin(),
new webpack.DllReferencePlugin({
context: __dirname,
manifest: require('./wwwroot/dist/vendor-manifest.json')
})
].concat(isDevBuild ? [
// Plugins that apply in development builds only
new webpack.SourceMapDevToolPlugin({
filename: '[file].map', // Remove this line if you prefer inline source maps
moduleFilenameTemplate: path.relative(bundleOutputDir, '[resourcePath]') // Point sourcemap entries to the original file locations on disk
})
] : [
// Plugins that apply in production builds only
new webpack.optimize.UglifyJsPlugin(),
new ExtractTextPlugin('site.css')
])
}];
};
这是package.json,因此我正在使用的软件包的版本如下所示:
{
"name": "MyProject",
"private": true,
"version": "0.0.0",
"devDependencies": {
"@types/history": "4.6.2",
"@types/react": "^16.4.1",
"@types/react-dom": "16.0.6",
"@types/react-hot-loader": "4.1.0",
"@types/react-router": "4.0.27",
"@types/react-router-dom": "4.2.7",
"@types/react-table": "^6.7.11",
"@types/webpack-env": "1.13.6",
"aspnet-webpack": "^3.0.0",
"aspnet-webpack-react": "^3.0.0",
"awesome-typescript-loader": "5.2.0",
"bootstrap": "4.1.1",
"css-loader": "0.28.11",
"event-source-polyfill": "0.0.12",
"extract-text-webpack-plugin": "3.0.2",
"file-loader": "1.1.11",
"isomorphic-fetch": "2.2.1",
"jquery": "3.3.1",
"json-loader": "0.5.7",
"react": "16.4.1",
"react-dom": "^16.4.1",
"react-hot-loader": "^4.3.3",
"react-router-dom": "4.3.1",
"style-loader": "0.21.0",
"typescript": "2.9.2",
"url-loader": "1.0.1",
"webpack": "^4.12.2",
"webpack-dev-middleware": "^3.1.3",
"webpack-dev-server": "^3.1.4",
"webpack-hot-middleware": "^2.22.2"
},
"dependencies": {
"@types/react-fontawesome": "^1.6.3",
"ajv": "^6.5.1",
"classnames": "^2.2.6",
"font-awesome": "^4.7.0",
"get-latest": "^0.1.0",
"latest-version": "^4.0.0",
"npm": "^6.1.0",
"npm-install-peers": "^1.2.1",
"popper.js": "^1.14.3",
"react-table": "^6.8.6",
"update-all-packages": "^1.0.2"
}
}