Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

191
Views
Babel remove comment blocks in js files

This is my babel.config.js:

module.exports = {
  presets: ["@vue/cli-plugin-babel/preset"],
  plugins: [
    [
      "search-and-replace",
      {
        rules: [
          {
            search: /(?:\/\*(?:[^\*]|\**[^\*\/])*\*+\/)|(?:\/\/[\S ]*)/,
            replace: "",
          },
        ],
      },
    ],
  ],
};

I used babel-plugin-search-and-replace to replace characters.

My goal is to remove comments from js files, for example: enter image description here I don't want the user could see the package description in the source codes. I tried other plugins and didn't succeed.

Thanks for your helping.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Solved by webpack:

  chainWebpack: (config) => {
    config.optimization.minimizer("terser").tap((args) => {
      args[0].terserOptions.output = {
        ...args[0].terserOptions.output,
        comments: false, // exclude all comments from output
      };
      return args;
    });
  },
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!