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. 致命錯誤: Class ’appfacadeTest’ not found2. 怎么php怎么通過數組顯示sql查詢結果呢,查詢結果有多條,如圖。3. 老師們php,插入數據庫mysql,都是空的,要怎么解決4. php點贊一天一次怎么實現5. sql語句 - 如何在mysql中批量添加用戶?6. 在mybatis使用mysql的ON DUPLICATE KEY UPDATE語法實現存在即更新應該使用哪個標簽?7. 在應用配置文件 app.php 中找不到’route_check_cache’配置項8. PHP類屬性聲明?9. 求大神支招,php怎么操作在一個html文件的<head>標記內添加內容?10. phpstady在win10上運行
