Ich habe versucht, den Sass-Loader im Webpack zu verwenden und folge dieser Anleitung ->https://github.com/webpack-contrib/extract-text-webpack-plugin#extracting-sass-or-less, aber das funktioniert nicht.Webpack 3: Sass-Loader verwenden und ExtractTextPlugin funktioniert nicht
Kann mir jemand helfen?
Repository
https://github.com/gpincheiraa/boolean-html-js-exercises/tree/dev
Fehler
ERROR in Error: Child compilation failed:
Module build failed: Error: "extract-text-webpack-plugin" loader is used without the corresponding plugin, refer to https://github.com/webpack/extract-text-webpack-plugin for the usage example
- Error: "extract-text-webpack-plugin" loader is used without the corresponding plugin, refer to https://github.com/webpack/extract-text-webpack-plugin for the usage example
Abhängigkeiten
node v6.11.1
npm 5.3.0
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
webpack.config.js
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
entry: [
"./index.js"
],
output: {
path: __dirname + "/dist",
filename: "index.bundle.js"
},
module: {
rules: [
{ test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" },
{ test: /\.md$/, loaders: [ "html-loader", "markdown-loader" ] },
{ test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', 'sass-loader']
})
}
]
},
plugins: [
new ExtractTextPlugin('style.css'),
new HtmlWebpackPlugin({
template: 'index.html',
inject: 'body'
})
],
devtool: "eval-source-map",
devServer: {
filename: "index.bundle.js",
contentBase: "./",
port: 3000,
publicPath: "/",
stats: {
colors: true
}
}
};
hast du mein Leben gerettet. War ein konzeptioneller Fehler von mir. Ich habe diese Dokumentation gelesen: https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md und schließlich verstehe ich für vollständig. Vielen Dank für Sie tolle Antwort! –
Die Änderung: https://github.com/gpincheiraa/boolean-html-js-exercises/commit/2290ff64079d9e6ced40d2cf1f82d2f612ca8745 –