-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
I'm trying to run webpack-dev-server accord the documentation, but I'm having a little problem:
webpack.config.js
'use strict';
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var HtmlWebpackPlugin = require('html-webpack-plugin');
const html_webpack_plugin = new HtmlWebpackPlugin({
title: 'Webpack boilerplate',
minify: {
collapseWhitespace: true
},
hash: true,
template: './source/index.html'
});
const extract_sass = new ExtractTextPlugin({
filename: 'app.css',
disable: false,
allChunks: true
})
module.exports = {
entry: './source/app.js',
output: {
path: 'build',
filename: 'app.bundle.js'
},
module: {
rules: [{
test: /\.sass$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [{
loader: 'css-loader',
options: {
sourceMap: true,
minimize: true
}
}, {
loader: 'sass-loader',
options: { sourceMap: true }
}],
publicPath: '/build'
})
}]
},
devServer: {
contentBase: path.join(__dirname, 'build'),
compress: true,
port: 9000
},
devtool: 'source-map',
plugins: [
html_webpack_plugin,
extract_sass
]
}
devServer configuration
devServer: {
contentBase: path.join(__dirname, 'build'),
compress: true,
port: 9000
}
error
/Users/antoniojunior/Projects/webpack-boilerplate/webpack.config.js:46
contentBase: path.join(__dirname, 'build'),
^
ReferenceError: path is not defined
at Object.<anonymous> (/Users/antoniojunior/Projects/webpack-boilerplate/webpack.config.js:46:18)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at requireConfig (/Users/antoniojunior/Projects/webpack-boilerplate/node_modules/webpack/bin/convert-argv.js:96:18)
at /Users/antoniojunior/Projects/webpack-boilerplate/node_modules/webpack/bin/convert-argv.js:109:17
at Array.forEach (native)
at module.exports (/Users/antoniojunior/Projects/webpack-boilerplate/node_modules/webpack/bin/convert-argv.js:107:15)
at Object.<anonymous> (/Users/antoniojunior/Projects/webpack-boilerplate/node_modules/webpack-dev-server/bin/webpack-dev-server.js:192:50)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
webpack version: ^2.2.1
webpack-dev-server: ^2.4.1
I forgot something?
humkins, catt-wuyang, victorarbuesmallada, jaroslawkrol, TitanFighter and 19 morecatt-wuyang and jhoneybee
Metadata
Metadata
Assignees
Labels
No labels