Skip to content

Babel Loader broken outside of source path #1870

Closed
@tomprats

Description

@tomprats

Problem

The babel-loader went from using an exclude, to using both an exclude and include. I'm not really sure the reasoning behind it, but since I keep my tests in a different folder (test/javascript), it broke them.

include: resolve(sourcePath),
exclude: /node_modules/,

Is the include necessary there? Should it maybe have been documented better that the babel loader would be more restricted than previously? Or did I just cause problems for myself because I may have been using it incorrectly in the first place?

Origin

Looks like it was introduced in the rc1 release here. It took me a long time to track down exactly what was failing since it gave me an Unexpected token error on the first angle bracket of some jsx, making me believe it was jsx or react specific.

Temporary Solution

Previously in my test config I just needed:

environment.resolvedModules.append("tests", "test/javascript")

But now I've updated it to be:

environment.resolvedModules.append("tests", "test/javascript")

const babelLoader = environment.loaders.get("babel")
babelLoader.include = [babelLoader.include, resolve("test/javascript")]

Is there a better solution? Should the babel-loader itself be different?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions