bundle.js果然存在与内存中,实时更新并看不到。 devServer: { static: "./" } 以上配置告知 webpack-dev-server,将 './' 目录下的文件 serve 到 localhost:8080 下(寄存到服务器下),就可以如下图了 1. 2. 3. 4. 1.
安装webpack-dev-server后,用 npm 打包运行,打开后显示 'Cannot get /' : 需要在webpack.config.js的devServer中添加以下代码: 现在再次运行,可以打开了:
照着视频走下来,安装配置好webpack-dev-server后npm run dev,页面显示 cannot get /,视频里运行正常,猜测是因为安装的版本不一样,网上说只要文档不在contentBase所指定的目录中,就只会显示cannot get;所以只要文档放在该目录下就能正常工作了 devServer:{contentBase:'./src',} 1. 2. 3. 加上后npm run dev...
resolve(__dirname, 'dist'), compress: true, port: 9000, open: true, } }; package.json "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "watch": "webpack --watch", "start": "webpack-dev-server --open", "build": "webpack --env.production" },前端工程...
照着视频走下来,安装配置好webpack-dev-server后npm run dev,页面显示 cannot get /,视频里运行正常,猜测是因为安装的版本不一样,网上说只要文档不在contentBase所指定的目录中,就只会显示cannot get;所以只要文档放在该目录下就能正常工作了 1 2 3
Operating System:Windows 10 Node Version: v8.9.3 NPM Version: v5.5.1 webpack Version: v3.10.0 webpack-dev-server Version: v2.9.5 This is a bug This is a modification request Code // webpack.config.js const path = require('path'); const w...
module.exports = { entry: "./src/index.js", output: { path: __dirname + '/dist', // publicPath: __dirname + '/dist/', filename: "bundle.js" }, devServer: { contentBase: "/dist", hot: true, } } 我的理解是 contentBase 告诉webpack 开发服务器从哪里提供文件。因此,如果我转到...
这个问题已解决,我的配置如下: devServer: { contentBase: path.join(__dirname, "dist"), compress: true, open: true, openPage: "webpack-dev-server", }, output: { path :path.resolve(__dirname, 'dist'), filename: 'js/[name].bundle.js', // publicPath:'../' }, 页面就可以显示了,...
配置如下: 执行webpack-dev-server,命令行提示如下: 页面显示如下:慕的地2839094 2018-03-26 15:12:08 源自:3-8 webpack-dev-server 3535 分享 收起 1回答 Rosen 2018-03-26 17:48:06 同http://coding.imooc.com/learn/questiondetail/48662.html 0 回复 ...
Operating System: Windows 10 x64 Node Version: 7.3.0 NPM Version: 3.10.10 webpack Version: 4.5.0 webpack-dev-server Version: 3.1.3 This is a bug This is a modification request Code https://github.com/MitchTalmadgeUofU/Digital-Story/tree/...