Javascript 网页包HotModuleReplacement插件不工作
我是webpack的新手,正在尝试探索如何在我的一些项目中使用它。我已经在本地项目上安装了webpack热中间件,下面是我在webpack.config.js中的代码。 在我运行webpack命令后,它不会做任何事情,不会打开新的浏览器选项卡并显示网页,它不会在终端中显示任何错误。我错过了什么Javascript 网页包HotModuleReplacement插件不工作,javascript,webpack,frontend,webpack-dev-server,webpack-hmr,Javascript,Webpack,Frontend,Webpack Dev Server,Webpack Hmr,我是webpack的新手,正在尝试探索如何在我的一些项目中使用它。我已经在本地项目上安装了webpack热中间件,下面是我在webpack.config.js中的代码。 在我运行webpack命令后,它不会做任何事情,不会打开新的浏览器选项卡并显示网页,它不会在终端中显示任何错误。我错过了什么 const webpack = require('webpack'); const CopyWebpackPlugin = require('copy-webpack-plugin'); const pa
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const path = require('path');
module.exports = {
entry: './dev/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'index.js',
},
devtool: 'source-map',
module: {
loaders: [
{
test: /\.js$/,
exclude: /(node_modules)/,
loader: 'babel-loader',
query: {
presets: ['es2015']
}
},
{
test: /\.scss$/,
loader: 'style-loader!css-loader!sass-loader',
},
{
test: /\.woff($|\?)|\.woff2($|\?)|\.ttf($|\?)|\.eot($|\?)|\.svg($|\?)/,
loader: 'url-loader'
}
]
},
plugins: [
new CopyWebpackPlugin([
{
from: './node_modules/bootstrap-sass/assets/fonts/bootstrap',
to: 'assets/fonts/bootstrap'
}
]),
new webpack.HotModuleReplacementPlugin()
]
};
终端输出:
Hash: e15c5a889e59610134b2
Version: webpack 3.4.1
Time: 3123ms
Asset Size Chunks Chunk Names
index.js 1.79 MB 0 [emitted] [big] main
index.js.map 2.24 MB 0 [emitted] main
assets/fonts/bootstrap/glyphicons-halflings-regular.eot 20.1 kB [emitted]
assets/fonts/bootstrap/glyphicons-halflings-regular.woff2 18 kB [emitted]
assets/fonts/bootstrap/glyphicons-halflings-regular.woff 23.4 kB [emitted]
assets/fonts/bootstrap/glyphicons-halflings-regular.ttf 45.4 kB [emitted]
assets/fonts/bootstrap/glyphicons-halflings-regular.svg 109 kB [emitted]
[2] ./node_modules/css-loader!./node_modules/sass-loader/lib/loader.js!./dev/sass/style.scss 159 kB {0} [built]
[5] (webpack)/buildin/global.js 509 bytes {0} [built]
[6] (webpack)/buildin/module.js 517 bytes {0} [built]
[127] ./dev/index.js 94 bytes {0} [built]
[128] ./dev/sass/style.scss 1.15 kB {0} [built]
[132] ./dev/bootstrap.js 214 bytes {0} [built]
[136] ./node_modules/moment/locale ^\.\/.*$ 2.79 kB {0} [optional] [built]
[157] ./dev/app.js 13 bytes {0} [built]
+ 150 hidden modules
您需要添加更多信息。您使用什么命令启动开发环境?您使用什么开发服务器
webpack dev server
,express
,koa
等。我仍然存在同样的问题,也无法用您的rply ans解决:/您需要添加更多信息。您使用什么命令启动开发环境?您使用什么开发服务器webpack dev server
、express
、koa
等。我仍然存在同样的问题,也无法用您的rply ans解决:/