@KnightForce

Webpack. Как исправить 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,
}


Пробовал разные варианты, пришел к вводу, что дело в ExtractTextPlugin.
Без него все собирается без ошибок.

Также пробовал:
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",
                }),
        },

И разные варианты.
Что делать?
  • Вопрос задан
  • 677 просмотров
Решения вопроса 1
@alterego8
разное
На странице https://github.com/webpack-contrib/extract-text-we... указано, что для webpack2 следует использовать beta версию плагина
# for webpack 2
npm install --save-dev extract-text-webpack-plugin@beta
мне помогло с такой же ошибкой.
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы