Pergunta

I'm trying to run two separate groups of tasks for the same files in order to produce two different builds. One of the tasks is grunt-browserify. I also use grunt-preprocess in order to remove parts for each build. In one of them, I remove a require of a module that I don't want Browserify to process.

// @if env='PROD'
var chrome = require('chrome');
// @endif

The processed file doesn't have the line, but somehow Browserify still thinks it is required and packs it in the bundle.

  • Tried changing the location of the intermediate files.
  • Added the ignore option to the grunt-browserify task specifying the unwanted module.
  • Tried using exclude but I get a Warning: Object # has no method 'exclude'.
  • Removed any reference to the unwanted file.
  • Commented out the require line.

But nothing worked. The module always shows up in the bundle.

I really can't figure out why the browserify task thinks it should include it...

Foi útil?

Solução

You are probably including indirectly that chrome file, because of an alias.

Make sure that no one of your aliases (if you are using any) is referring to unprocessed files.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top