question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

webpack-obfuscator doesn't work with favicons-webpack-plugin

See original GitHub issue

Trying to use this awesome obfuscator with my project I was getting the following error:

/home/ezze/Development/geoport/node_modules/inversify/lib/planning/metadata_reader.js:8
        var compilerGeneratedMetadata = Reflect.getMetadata(METADATA_KEY.PARAM_TYPES, constructorFunc);
                                                ^
TypeError: Reflect.getMetadata is not a function
    at MetadataReader.getConstructorMetadata (/home/ezze/Development/geoport/node_modules/inversify/lib/planning/metadata_reader.js:8:49)
    at getTargets (/home/ezze/Development/geoport/node_modules/inversify/lib/planning/reflection_utils.js:15:35)
    at Object.getDependencies (/home/ezze/Development/geoport/node_modules/inversify/lib/planning/reflection_utils.js:10:19)
    at /home/ezze/Development/geoport/node_modules/inversify/lib/planning/planner.js:106:51
    at Array.forEach (<anonymous>)
    at _createSubRequests (/home/ezze/Development/geoport/node_modules/inversify/lib/planning/planner.js:94:20)
    at Object.plan (/home/ezze/Development/geoport/node_modules/inversify/lib/planning/planner.js:129:9)
    at /home/ezze/Development/geoport/node_modules/inversify/lib/container/container.js:243:37
    at Container._get (/home/ezze/Development/geoport/node_modules/inversify/lib/container/container.js:236:44)
    at Container.get (/home/ezze/Development/geoport/node_modules/inversify/lib/container/container.js:195:21)
    at e.value (/home/ezze/Development/geoport/node_modules/javascript-obfuscator/dist/webpack:/src/container/InversifyContainerFacade.ts:126:34)
    at Function.value (/home/ezze/Development/geoport/node_modules/javascript-obfuscator/dist/webpack:/src/JavaScriptObfuscatorFacade.ts:26:17)
    at /home/ezze/Development/geoport/node_modules/webpack-obfuscator/index.js:49:66
    at Array.forEach (<anonymous>)
    at Compilation.<anonymous> (/home/ezze/Development/geoport/node_modules/webpack-obfuscator/index.js:27:23)
    at Compilation.applyPluginsAsyncSeries (/home/ezze/Development/geoport/node_modules/webpack/node_modules/tapable/lib/Tapable.js:206:13)

Finally I narrowed the problem and stated that this one happens when both favicons-wepback-plugin and obfuscator plugin are used. I use favicons-webpack-plugin with html-webpack-plugin and html-webpack-template this way:

new HtmlPlugin({
    filename: path.resolve(__dirname, 'dist/index.html'),
    inject: false,
    template: htmlTemplate,
    title: 'RIPI GeoPort',
    meta: [{
        'http-equiv': 'Cache-Control',
        content: 'no-cache, no-store, must-revalidate'
    }, {
        'http-equiv': 'Pragma',
        content: 'no-cache'
    }, {
        'http-equiv': 'Expires',
        content: '0'
    }],
    appMountId: 'container',
    scripts: ['cesium/Cesium.js'],
    minify: {
        collapseWhitespace: NODE_ENV === 'production'
    }
}),
new FaviconsWepbackPlugin(
    path.resolve(__dirname, 'src/favicon.png')
)

What is the reason of this error and is it possible to solve it?

My environment: Ubuntu 16.04 LTS Node 8.9.4 Webpack 3.8.1

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sanex3339commented, Feb 22, 2018

Hi. Try to reinstall favicons-webpack-plugin plugin. harmony-reflect just was updating to 1.6.0 version and this bug was fixed.

1reaction
sanex3339commented, Feb 9, 2018

So, harmony-reflect has different Reflect API than reflect-metadata. https://github.com/tvcutsem/harmony-reflect/blob/master/doc/api.md

I can’t just add condition to the loading of reflect-metadata like this:

if (!global.Reflect) {
    require('reflect-metadata');
}

So, current way is to use different plugin to generate favicons.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exclude in webpack-obfuscator does not work - Stack Overflow
In the end, we just want to exclude node_modules from obfuscation). The versions javascript-obfuscator (4.0.0) and webpack-obfuscator (3.5.1) ...
Read more >
favicons-webpack-plugin-ico-fix - npm
Start using favicons-webpack-plugin-ico-fix in your project by running `npm i ... (By default the context is the current working directory).
Read more >
favicons-webpack-plugin examples - CodeSandbox
Learn how to use favicons-webpack-plugin by viewing and forking example apps that make use of favicons-webpack-plugin on CodeSandbox. @bpiwek/frontbox.
Read more >
webpack-obfuscator - npm Package Health Analysis - Snyk
Learn more about webpack-obfuscator: package health score, popularity, ... No known security issues ... npm i snyk -g && snyk test webpack-obfuscator.
Read more >
webpack-obfuscator/readme.md - UNPKG
The CDN for webpack-obfuscator. ... 51, AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE. 52, IMPLIED WARRANTIES OF MERCHANTABILITY ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found