Skip to content

babel-loader excludes ignored #4

@chris-feist

Description

@chris-feist

Using babel 7 and webpack 4, the excludes defined for babel-loader already filter out files before running them through this plugin. However, the plugin does not honor that and instead uses its own exclude option.

My example webpack rule:

      {
        test: /\.js$/,
        exclude: [/node_modules\/(?!(some-module-that-needs-logger)\/).*/],
        use: [
          {
            loader: 'babel-loader',
          },
        ],
      },

My babel.config.js plugin

    [
      'js-logger',
      {
        // TODO:  The next line should not be needed, but because of this bug, all node-modules are excluded instead of honoring the exclusions defined for the babel-loader
        exclude: [/node_modules\/(?!(some-module-that-needs-logger)\/).*/],
        format: {
          // some js-logger config
        },
      },
    ],

Basically with the latest babel and webpack, the exclusion checking code in this plugin can be removed. Maybe it wasn't needed in the first place, but I don't know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions