Skip to content

Instantly share code, notes, and snippets.

@gkatsanos
Created April 22, 2017 22:26
Show Gist options
  • Save gkatsanos/321d97d12812302bdd173225231b18e0 to your computer and use it in GitHub Desktop.
Save gkatsanos/321d97d12812302bdd173225231b18e0 to your computer and use it in GitHub Desktop.
The Webpack-dev-server is not writing files to disk
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const path = require('path');
const exclude = /node_modules/;
module.exports = {
entry: {
"js/bundle": "./js/src/main",
"css/main": "./sass/main.scss",
"css/frontpage": "./sass/frontpage.scss"
},
output: {
filename: "[name].js",
path: path.resolve(__dirname, "./dist")
},
module: {
rules: [
{
test: /\.js$/,
enforce: "pre",
exclude: exclude,
use: [
"babel-loader",
"eslint-loader"
]
},
{ test: /\.(jpg|png|svg)$/, loader: 'file-loader?name=[name].[ext]?[hash]&publicPath=../&outputPath=images/' },
{ test: /\.(woff|woff2|eot|ttf)$/, loader: 'file-loader?name=[name].[ext]?[hash]&publicPath=../&outputPath=fonts/' },
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', 'postcss-loader'],
})
},
{
test: /\.s[ac]ss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{
loader: "css-loader",
options: {
importLoaders: 1,
sourceMap: true
}
},
{
loader: "sass-loader",
options: {
sourceMap: true,
includePaths: [
path.resolve(__dirname, './node_modules/bootstrap-sass/assets/stylesheets'),
]
}
},
],
})
}
]
},
devtool: "source-map",
devServer: {
contentBase: path.join(__dirname, "./"),
publicPath: "/Users/Georgios/Development/rocket-internet/INTROCK2/drupal/web/themes/rocket/dist/",
compress: true,
port: 9000,
proxy: {
"/": "http://ops.rocket-internet.dev/"
}
},
plugins: [
new ExtractTextPlugin({ // define where to save the file
filename: "./[name].css",
allChunks: true,
}),
],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment