GoogleChromeLabs/prerender-loader

Extracting css/scss on build time

Open

#18 ouverte le 16 oct. 2018

Voir sur GitHub
 (8 commentaires) (0 réactions) (0 assignés)JavaScript (61 forks)batch import
bughelp wanted

Métriques du dépôt

Stars
 (1 915 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

Hi, the prerender-loader works fine for me except when it comes to css.

In my index.js: import './style.scss

But when I run the build I get this error:

ERROR in ./web-assets/scss/style.scss 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

webpack.prod.config:

output: {
    filename: "[name]-[chunkhash].js",
    chunkFilename: "[id].[chunkhash].bundle.js",
    publicPath: '/static/dist/',
    path: __dirname + "/dist"
},

plugins: [

    new webpack.optimize.UglifyJsPlugin(),
    new webpack.LoaderOptionsPlugin({ minimize: true }),
    new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
    new HtmlWebpackPlugin({
        filename: 'index.html',
        template: '!!prerender-loader?string!index.html',
    }),
    new ExtractTextPlugin("[name]-[chunkhash].css"),
  

],

module: {
    rules: [

        {
            test: /\.css$/,
            use: ExtractTextPlugin.extract({
                fallback: "style-loader",
                loader: "css-loader"
            })
        },
        {
            test: /\.scss/,
            use: ExtractTextPlugin.extract({
                fallback: "style-loader",
                loader: [
                    {
                        loader: 'css-loader',
                        options: {
                            sourceMap: true
                        }
                    },
                    {
                        loader: 'sass-loader',
                        options: {
                            sourceMap: true
                        }
                    }
                ]
            })
        },  
    ]
}

Guide contributeur