0

I have a very large JS file pleaseExcludeMe.js that is already minified and transpiled included in my vue project, which is using the default webpack setup.

I want to exclude that file from Webpack transpilation/transformation, but is is needed in the bundle obviously.

That file is imported by Rooms.vue.

This is my project structure:

root
  src/
    views/
      rooms/
        Rooms.vue
        pleaseExcludeMe.js  
  package.json

In my vue.config.js, I already tried this:

configureWebpack: {
    module: {
        rules: [
            {
                test: /pleaseExcludeMe/,
                loader: 'null-loader', // also tried 'dumb-loader'
                exclude: /pleaseExcludeMe/, // this seems to exclude the file from the bundle
            },
        ],
    },
},

How can I exclude that specific file?

1 Answer 1

2

I figured it out:

const path = require('path');

// ...
rules: [
  test: /\.js$/,
  exclude: [
    path.resolve(__dirname, 'src/views/rooms/pleaseExcludeMe.js'),
  ],
]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.