Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpack 2 misc/compile/end missing #30

Open
stephencookdev opened this issue Mar 19, 2018 · 10 comments
Open

Webpack 2 misc/compile/end missing #30

stephencookdev opened this issue Mar 19, 2018 · 10 comments

Comments

@stephencookdev
Copy link
Owner

@guptakvgaurav managed to get the following error with his webpack set-up:

Could not find a matching event to end misc compile { fillLast: true }
/Users/ttn/labs/ttn_web/node_modules/speed-measure-webpack-plugin/index.js:104
        throw new Error("No matching event!");
        ^

Error: No matching event!
    at SpeedMeasurePlugin.addTimeEvent (/Users/ttn/labs/ttn_web/node_modules/speed-measure-webpack-plugin/index.js:104:15)
    at Compiler.compiler.plugin (/Users/ttn/labs/ttn_web/node_modules/speed-measure-webpack-plugin/index.js:118:12)
    at Compiler.applyPlugins (/Users/ttn/labs/ttn_web/node_modules/tapable/lib/Tapable.js:61:14)
    at /Users/ttn/labs/ttn_web/node_modules/webpack/lib/Compiler.js:271:13
    at Compiler.emitRecords (/Users/ttn/labs/ttn_web/node_modules/webpack/lib/Compiler.js:367:37)
    at /Users/ttn/labs/ttn_web/node_modules/webpack/lib/Compiler.js:265:12
    at /Users/ttn/labs/ttn_web/node_modules/webpack/lib/Compiler.js:360:11
    at next (/Users/ttn/labs/ttn_web/node_modules/tapable/lib/Tapable.js:218:11)
    at Compiler.compiler.plugin (/Users/ttn/labs/ttn_web/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)
    at Compiler.applyPluginsAsyncSeries1 (/Users/ttn/labs/ttn_web/node_modules/tapable/lib/Tapable.js:222:13)
    at Compiler.afterEmit (/Users/ttn/labs/ttn_web/node_modules/webpack/lib/Compiler.js:357:8)
    at Compiler.<anonymous> (/Users/ttn/labs/ttn_web/node_modules/webpack/lib/Compiler.js:352:14)
    at /Users/ttn/labs/ttn_web/node_modules/async/dist/async.js:473:16
    at iteratorCallback (/Users/ttn/labs/ttn_web/node_modules/async/dist/async.js:1050:13)
    at /Users/ttn/labs/ttn_web/node_modules/async/dist/async.js:958:16
    at /Users/ttn/labs/ttn_web/node_modules/graceful-fs/graceful-fs.js:43:10

with the following webpack config:

const config = {
    entry: {
      app: ['babel-polyfill', './src/index.js'],
        vendor: ['react', 'react-dom']
    },
    output: {
        filename: 'bundle.js',
        path: path.resolve(__dirname, 'dist'),
        publicPath: '/'
    },
    module: {
        rules: [
            // {
            //     test: /\.json$/,
            //     exclude: [
            //         path.resolve(__dirname, 'node_modules'),
            //     ],
            //     loader: 'json-loader'
            // },
            {
                test: /.(jsx|js)?$/,
                exclude: [
                    path.resolve(__dirname, 'node_modules'),
                ],
                loader: 'babel-loader',
            },
            {
                test: /.(scss|css)$/,
                use: ExtractTextPlugin.extract({
                    fallback: 'style-loader',
                    //resolve-url-loader may be chained before sass-loader if necessary
                    use: [{loader: 'css-loader'}, {loader: 'sass-loader', options: {includePaths: [ './node_modules/bourbon' ]}}]
                }),
            },
            {
                test: /\.(otf|png|jpg|jpeg|gif|ttf|eot|svg|woff|woff2)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
                use: 'url-loader?limit=10000',
            },
            {
                test: /\.yaml$/,
                use: [
                    {loader: 'json-loader'},
                    {loader: 'yaml-loader'},
                ]
            },
            {
                test: /\.html$/,
                loader: 'html-loader'
            }
        ]
    },
    resolve: {
        alias: {
            utils: path.resolve(__dirname, './src/utils'),
            constants: path.resolve(__dirname, './src/constants'),
            components: path.resolve(__dirname, './src/app/components'),
            containers: path.resolve(__dirname, './src/app/containers'),
            core: path.resolve(__dirname, './src/app/core'),
            lodashC: path.resolve(__dirname, './src/js/lodash.custom.min.js')
        },
        extensions: ['.js', '.jsx'],
    },
    devtool: 'source-map',
    plugins: [
        // new CleanWebpackPlugin(pathsToClean, cleanOptions),
        // new BundleAnalyzerPlugin(),
        new ExtractTextPlugin({
            filename:'style.css',
            disable: false
        }),
        new webpack.optimize.CommonsChunkPlugin({
            names: 'vendor',
            filename: 'vendor.js'
        }),
        new webpack.DefinePlugin({
            'VENDOR': JSON.stringify(process.env.VENDOR),
            'NODE_ENV': JSON.stringify(process.env.NODE_ENV),
            "process.env": {
                "NODE_ENV": JSON.stringify(process.env.NODE_ENV),
            }
        }),
        new HtmlWebpackPlugin({
            filename: 'index.html',
            template: 'src/index.html'
        }),
        new LiveReloadPlugin(),
        new WebpackBrowserPlugin({
            port: 3000,
            url: 'http:https://127.0.0.1'
        }),
    ]
};

module.exports = smp.wrap(config);

webpack version - 2.6
smp version - 1.1.3

@stephencookdev
Copy link
Owner Author

@guptakvgaurav - this is a bit of an odd error to me. Basically it means that you've hit the "compile/end" flow without ever hitting the "compile/start" flow 🤔

Would you mind sharing how you're running webpack? I.e. what command are you calling, are you in run-mode or watch-mode, etc. etc.?

@appienvanveen
Copy link

I've got the same issue with Wepack 3.10. I'm running the generated setup created by Jhipster. Any idea?

@appienvanveen
Copy link

Solved it. It appeared I've had an older version of the merge-jsons-webpack-plugin.
I was using 1.0.11. Updating to 1.0.15 solved the issue.

@vidal7
Copy link

vidal7 commented Feb 8, 2019

I am getting this error with webpack 4
Could not find a matching event to end plugins Object/Compiler/afterEmit
Is this related to this issue?

@ikobe-zz
Copy link

ikobe-zz commented Feb 19, 2019

webpack 4 +1

I write a plugin with following:

class DemoPlugin {
  constructor(options) {
    assert(options, 'options is required');
  }
  public apply(compiler) {
    compiler.hooks.done.tapAsync('monitor', (stats, callback) => {
      console.log('xxx);
      setTimeout(callback(), 1000);
    });
  }
}

The error message is:

Could not find a matching event to end plugins DemoPlugin/Compiler/done { id: 12136 }

If I use compiler.hooks.done.tap, the error message will disappear

It seems like speed-measure-webpack-plugin cannot support tapAsync function

@ikobe-zz
Copy link

ikobe-zz commented Feb 19, 2019

Solved it. I fix it by using setImmediate:

compiler.hooks.done.tapAsync('monitor', (stats, callback) => {
  console.log('xxx);
  setImmediate(async () => { callback() });
});

@sarahquigley
Copy link

@stephencookdev I am encountering a similar error:
Could not find a matching event to end plugins CopyPlugin/Compiler/afterEmit { id: 28 }

@jrnail23
Copy link

I'm getting the same as @vidal7 (Could not find a matching event to end plugins Object/Compiler/afterEmit) when using stylelint-webpack-plugin.

@fengzilong
Copy link

fengzilong commented May 30, 2019

@stephencookdev I am encountering a similar error:
Could not find a matching event to end plugins CopyPlugin/Compiler/afterEmit { id: 28 }

the same error for copy-webpack-plugin with webpack4

@dave-educode
Copy link

I am having this same problem as fengzilong with the copy-webpack-plugin. I would really like to fix this. Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants