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(Imports Loader v1.x, v2.x) not work #639

Open
hrkksm10 opened this issue Sep 17, 2020 · 2 comments
Open

Webpack(Imports Loader v1.x, v2.x) not work #639

hrkksm10 opened this issue Sep 17, 2020 · 2 comments

Comments

@hrkksm10
Copy link

not work

module: {
  rules: [
    {
      test: require.resolve('snapsvg/dist/snap.svg.js'),
      use: 'imports-loader?this=>window,fix=>module.exports=0',
    },
  ],
},

work

module: {
  rules: [
    {
      test: require.resolve('snapsvg/dist/snap.svg.js'),
      use: 'imports-loader?wrapper=window&additionalCode=module.exports=0;',
    },
  ],
},
This was referenced Jan 24, 2021
@hrkksm10 hrkksm10 changed the title Webpack(Imports Loader v1.x.x) not work Webpack(Imports Loader v1.x, v2.x) not work Feb 2, 2021
@lt2396261331
Copy link

oh thank's

@abid-mujtaba
Copy link

The corresponding config in expanded format (verified to work with webpack@"^5.75.0" and imports-loader@"^4.0.1"):

    module: {
        rules: [
            {
                test: require.resolve('snapsvg/dist/snap.svg.js'),
                use: [
                    {
                        loader: 'imports-loader',
                        options: {
                            wrapper: 'window',
                        }
                    },
                    {
                        loader: 'imports-loader',
                        options: {
                            additionalCode: 'module.exports = 0;'
                        }
                    }
                ]
            }
        ]
    }

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

3 participants