Home

Issue: 2559

About [Add webpack plugins]. How to add some special attributes to my js files ?

[issue link]

Just like this, I use script-ext-html-webpack-plugin to add crossorigin=anonymous.

const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin')

module.exports = {
    build: [
     plugins: [
          // Add webpack plugins,
          // https://github.com/numical/script-ext-html-webpack-plugin
          new ScriptExtHtmlWebpackPlugin({
            defaultAttribute: 'defer',
            custom: [
              {
                test: /\.js$/,
                attribute: 'crossorigin',
                value: 'anonymous'
              }
            ]
          }),
        ],
    ],
}

But it doesn’t work.

This question is available on Nuxt.js community (#c2225)