Reputation: 173
I'm having fun with webpack, but I've got strange thing.. I did a little config with youtube tutorial, and it works, but: in my dist folder I cant see generated app.css, why? Ps. Its tutorial with webpack2
const ExtractTextPlugin = require("extract-text-webpack-plugin");
var HtmlWebpackPlugin = require('html-webpack-plugin');
var path = require("path");
module.exports = {
entry: {
app: './src/app.js',
contact: './src/contact.js'
},
output: {
path: path.resolve(__dirname, "dist"),
filename: '[name].bundle.js'
},
module: {
rules: [
{test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', 'sass-loader'],
allChunks: true
})
}
]
},
devServer:{
contentBase: path.join(__dirname, "dist"),
compress: true,
port: 9000,
stats: "errors-only",
open: true
},
plugins: [
new HtmlWebpackPlugin({
title: 'fsdfsdfsdfsdf',
hash: true, // ważne dla bezpieczeństwa
excludeChunks: ['contact'],
template: './src/index.html' // Load a custom template (lodash by default see the FAQ for details)
}),
new HtmlWebpackPlugin({
title: 'fsdfsdfsdfsdf',
hash: true,
chunks: ['contact'],
filename: 'contact.html',
template: './src/contact.html'
}),
new ExtractTextPlugin({
filename: 'app.css'
})
]
}
I've got in extract text plugin name, and I had publicPath, but in W3 its not supported i guess.
Upvotes: 0
Views: 54
Reputation: 1271
Webpack needs an entry
point from where it builds dependency graph and then processes/bundles all that is in the graph.
While your webpack config has everything in place to process the sass files, the source code must be missing to specify the dependency. Its typically done with require("some.scss")
where its required.
From your last comment its not clear if you figured out the issue. If not hope this helps.
Upvotes: 1