0

I have vue cli project. I want to exclude js files inside spesific folder using exclude rules, but not working. Bundle file still have js code that i want to exclude.

I want exclude *.js files inside fake-db folder. Here is my folder structure

enter image description here

Using exclude rules inside configureWebpack but not working.

  configureWebpack: () => {
    if (process.env.NODE_ENV === 'production') {
      return {
        module: {
          rules: [{
            test: /\.js$/,
            exclude: path.resolve(__dirname, 'src/fake-db') 
          }]
        }
      }
    }
  }

What the other way that I have to use for excluding spesific js file from bundling?

1
  • anyone can help? Commented Apr 5, 2021 at 2:39

1 Answer 1

0

I was able to exclude the test files from the bundle adding them to the tsconfig.json config file like this:

{

  "exclude": ["tests", "node_modules"]

}

The typescript docs recommends using the jsconfig.json file for JS projects. Maybe this can work in your case, something like:

{
      "exclude": ["fake-db"]
}
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.