momocow / webpack-userscript

A Webpack plugin for userscript projects. 🙈
https://cow.moe/webpack-userscript/
MIT License
200 stars 21 forks source link

Howto skip source map files? #28

Closed Glandos closed 4 years ago

Glandos commented 4 years ago

Currently, every output file are parsed with the userscript header, even .js.map files. This is completely unneeded. Is there a way to exclude some files?

momocow commented 4 years ago

Thanks for reporting the problem.

Can you share a minimal webpack.config.js for me to reproduce?

Glandos commented 4 years ago
const WebpackUserscript = require('webpack-userscript')

module.exports = {
    entry: './src/mvvm.ts',
    module: {
      rules: [
        {
          test: /\.(js|ts)$/,
          exclude: /node_modules/,
          use: ['babel-loader']
        }
      ]
    },
    resolve: {
      extensions: ['*', '.js', '.ts']
    },
    output: {
      path: __dirname + '/dist',
      publicPath: '/',
      filename: 'mvvn.user.js'
    },
    devServer: {
      contentBase: './dist'
    },
    devtool: 'source-map',
    plugins: [
      new WebpackUserscript({
        metajs: false,
        downloadBaseUrl: 'http://localhost:8000/',
        headers: {
          grant: ['GM.xmlHttpRequest', 'GM_xmlhttpRequest']
        }
      })
    ]
  };

So there is Babel and Typescript in the loop, I don't know if it's important :)

inazuma-bot commented 4 years ago

:tada: This issue has been resolved in version 2.5.4 :tada:

The release is available on:

Your semantic-release bot :package::rocket: