Skip to content
This repository has been 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

Closed
PAkerstrand opened this issue May 25, 2016 · 1 comment
Closed
Labels

Comments

@PAkerstrand
Copy link

PAkerstrand commented May 25, 2016

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')]
      }
    }
  }
}
@PAkerstrand PAkerstrand changed the title Create a way to declaratively exclude modules/paths from babel-loaders Create a way to declaratively exclude modules/paths from babel-loader May 25, 2016
@dlmr dlmr added the feature label May 25, 2016
@dlmr
Copy link
Member

dlmr commented Jan 2, 2018

This issue has been moved into the mono repository rocjs/extensions#23.

@dlmr dlmr closed this as completed Jan 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants