K
K
KnightForce2017-02-17 20:28:05
webpack
KnightForce, 2017-02-17 20:28:05

webpack. How to fix Chunk.entry was removed. Use hasRuntime()?


/home/projects/Game/node_modules/webpack/lib/Chunk.js:59
throw new Error("Chunk.entry was removed. Use hasRuntime()");
^
Error: Chunk.entry was removed. Use hasRuntime()
at Chunk.get entry [as entry] (/home/projects/Game/node_modules/webpack/lib/Chunk.js:59:9)
at /home/projects/Game/node_modules/extract-text-webpack -plugin/index.js:201:13
at Array.filter (native)
at Compilation. (/home/projects/Game/node_modules/extract-text-webpack-plugin/index.js:200:37)
at Compilation.applyPlugins0 (/home/projects/Game/node_modules/tapable/lib/Tapable.js:68: 14)
at Compilation.seal (/home/projects/Game/node_modules/webpack/lib/Compilation.js:558:8)
at /home/projects/Game/node_modules/webpack/lib/Compiler.js:474:16
at /home/projects/Game/node_modules/tapable/lib/Tapable.js:225:11
at _addModuleChain (/home/projects/ Game/node_modules/webpack/lib/Compilation.js:472:11)
at processModuleDependencies.err (/home/projects/Game/node_modules/webpack/lib/Compilation.js:443:13)
at _combinedTickCallback (internal/process/next_tick .js:67:7)
at process._tickCallback(internal/process/next_tick.js:98:9)

webpack.config.js :
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require("extract-text-webpack-plugin");

const extractCSS = new ExtractTextPlugin('./public/stylesheets/[name].css');
const extractLESS = new ExtractTextPlugin('./public/stylesheets/[name].less');

module.exports = {

    context: path.join(__dirname, 'frontend'),
    entry: {

        style: 'stylesheets/style.less',
        babelPolyfill: "babel-polyfill",
        ReactIgnore: "./ReactIgnore",
        App: "./App",
        index: "./index.js",
        initialState: "./initialState.js",
    },
    output: {
        path: path.join(__dirname, 'public'),
        filename: '[path][name].[ext]',
        publicPath: '/public/',
        library: '[name]'
    },
    resolve: {
        modules: [path.resolve(__dirname, "node_modules")]
    },
    resolveLoader: {
         modules: ["web_loaders", "web_modules", "node_loaders", "node_modules"],
    },

    module: {
      rules: [
        {
            exclude: /\/node_modules/,
            loader: "babel-loader",
            options: {
                presets: [['es2015', {modules: false}], "es2016", "es2017", "react"],
                plugins: ['transform-runtime'], 
            },
        },
        {
            test: /\.less$/,
            use: extractLESS.extract(["css-loader", "less-loader"]
               
        },
        {
            test: /\.css$/,
            use: extractCSS.extract(["css-loader"]),
 
        },
        {
            test: /\.(png|jpg|svg|ttf|eot|woff|woff2)$/,
            use: "file?name=[path][name].[ext]",
        }
      ]
    },
    plugins: [
        
        new webpack.ProvidePlugin({
            $: "jquery",
            jQuery: "jquery",
            "window.jQuery": "jquery",
            
        }),

        new webpack.NoEmitOnErrorsPlugin(),
        extractLESS,
        extractCSS,
       
    ],
    watch: true,
}

I tried different options, I came to the input that the matter is in ExtractTextPlugin .
Without it, everything is assembled without errors.
Also tried:
use: ExtractTextPlugin.extract(
                {
                    fallback: "style-loader",
                    use: ["css-loader","autoprefixer-loader?browsers=last 2 versions","less-loader"],
                    publicPath: "./public/stylesheets",
                }),
            },
        {
            test: /\.css$/,
            use: ExtractTextPlugin.extract(
                {
                    fallback: "style-loader",
                    use: ["css-loader","autoprefixer-loader?browsers=last 2 versions"],
                    publicPath: "./public/stylesheets",
                }),
        },

And different options.
What to do?

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
V
Vladimir, 2017-02-22
@KnightForce

https: //github.com/webpack-contrib/extract-text-we ... states that webpack2 should use the beta version of the plugin
# for webpack 2
npm install --save-dev extract-text-webpack-plugin @beta
helped me with the same error.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question