javascript - webpack-dev-server 用node方式报错
问题描述
//webpack.config.jsmodule.exports = { resolve:{ alias: { common: path.resolve(__dirname, ’../src/_common’), node_modules: path.resolve(__dirname, ’../node_modules’) } }, module:{ rules:[ {test:/.(js|jsx)$/,loader:’babel-loader’,exclude:/node_modules/,query: { presets: [’es2015’,’stage-0’]} } ] }};
//devConfig.jsmodule.exports = { entry: [ ’webpack-dev-server/client?http://localhost:8080’, ’webpack/hot/dev-server’, path.resolve(__dirname, ’../src/demo/index.js’) ], output: { filename: 'bundle.js', publicPath: ’http://localhost:8080/assets/’ }, devtool:’eval-source-map’, module: { rules: [{ test:/.scss$/, use: ['css-loader?-autoprefixer&sourceMap', ’postcss-loader’, 'sass-loader']} ] }, plugins: [ new webpack.DefinePlugin({’process.env.NODE_ENV’: ’'development'’ }), new webpack.HotModuleReplacementPlugin(), new OpenBrowserPlugin({}), new HtmlWebpackPlugin({title: ’demo’,filename: ’demo/index.html’,inject: true,chunks: [’demo/index’],template: path.resolve(__dirname, ’../src/demo/index.html’) }) ] }
gulp.task(’dev’,() => { let optionConfig = merge(webpackconfig, devConfig); const myDevConfig = Object.create(optionConfig); new webpackDevServer(webpack(myDevConfig), { stats: { colors: true }, publicPath: devConfig([’demo’]).output.publicPath, historyApiFallback: true, hot: true, watchOptions: { poll: true, watch: true }, watchContentBase: true }).listen(8080, 'localhost', function(err) { if(err) throw new gutil.PluginError('webpack-dev-server', err); gutil.log('[webpack-dev-server]', 'http://localhost:8080/webpack-dev-server/index.html'); });});
请问哪里配置错误了?
问题解答
回答1:没有看到devserver的配置啊
相关文章:
1. javascript - electron中的a标签怎么用浏览器直接打开而不是在框架窗体内2. 前端 - 谁来解释下这两个 CSS selector 区别3. 为啥获取不到呀?4. mysql每隔10来秒就有一次7、8MB的写入5. html5 - 最近在自学react 求一个react表单提交的例子6. javascript - 怎么实现让 div 里面的 img 元素 中心居中, 如下示例图7. window下mysql中文乱码怎么解决??8. javascript - vscode alt+shift+f 格式化js代码,通不过eslint的代码风格检查怎么办。。。9. html5 - bootstrap修改样式的问题10. javascript - ie11以下单击打开不了file,双击可以。求解?
