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. 視頻文件不能播放,怎么辦?2. mysql - 把一個表中的數(shù)據(jù)count更新到另一個表里?3. 請教使用PDO連接MSSQL數(shù)據(jù)庫插入是亂碼問題?4. mysql 查詢身份證號字段值有效的數(shù)據(jù)5. visual-studio - Python OpenCV: 奇怪的自動補全問題6. mysql - 分庫分表、分區(qū)、讀寫分離 這些都是用在什么場景下 ,會帶來哪些效率或者其他方面的好處7. node.js - nodejs開發(fā)中常用的連接mysql的庫8. linux - Ubuntu下編譯Vim8(+python)無數(shù)次編譯失敗9. python - 爬蟲模擬登錄后,爬取csdn后臺文章列表遇到的問題10. Python爬蟲如何爬取span和span中間的內(nèi)容并分別存入字典里?
