javascript - webpack-dev-server 用node方式報(bào)錯(cuò)
問(wèn)題描述
//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'); });});
請(qǐng)問(wèn)哪里配置錯(cuò)誤了?
問(wèn)題解答
回答1:沒(méi)有看到devserver的配置啊
相關(guān)文章:
1. javascript - npm下載的模塊不完整是什么問(wèn)題?2. java - Spring事務(wù)回滾問(wèn)題3. apache - 本地搭建wordpress權(quán)限問(wèn)題4. c++ - 如何在python的阻塞的函數(shù)中獲取變量值5. node.js - 我想讓最后進(jìn)入數(shù)據(jù)庫(kù)的數(shù)據(jù),在前臺(tái)最先展示,如何做到?6. wordpress - Nginx中禁止訪問(wèn)txt,robots.txt文件例外,規(guī)則該怎么寫(xiě)?7. 剛放到服務(wù)器的項(xiàng)目出現(xiàn)這中錯(cuò)誤,有高手指點(diǎn)嗎8. python - django 按日歸檔統(tǒng)計(jì)訂單求解9. python 操作mysql如何經(jīng)量防止自己的程序在之后被惡意注入(說(shuō)白了就是問(wèn)一下python防注入的一些要點(diǎn))10. mysql - 面試題:如何把login_log表轉(zhuǎn)換成last_login表?
