Skip to content
This repository was archived by the owner on Jan 2, 2018. It is now read-only.
This repository was archived by the owner on Jan 2, 2018. It is now read-only.

Create a way to declaratively exclude modules/paths from babel-loader #10

@PAkerstrand

Description

@PAkerstrand

We have some vendor files that are already webpacked, babelified etc. These files have a tendency to break if they run through babel-loader a second time. For the time being, we solve it like this in an action in our roc.config.js-file:

const babelLoader = rocBuilder.buildConfig.module.loaders.find((loaderConfig) => loaderConfig.id === 'babel');
if (babelLoader) {
    if (!babelLoader.exclude) {
        babelLoader.exclude = [];
    }
    if (!Array.isArray(babelLoader.exclude)) {
        babelLoader.exclude = [babelLoader.exclude];
    }
    babelLoader.exclude = babelLoader.exclude.concat([
        path.resolve('./src/vendor'),
    ]);
}

return rocBuilder;

It would be really neat if the boilerplate can be hidden, and Roc provided a way to declaratively add paths/RegExps/modules to be hidden from the babel-loader:

settings: {
  build: {
    loaders: {
      babel: {
        exclude: [path.resolve('./src/vendor')]
      }
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions