Skip to content

Preset's name for scoped packages #8236

@artola

Description

@artola

I have presets for all the parts in the tool-chain, from Jest to TSLint. Then I did the same for Babel.
The preset works perfectly, if the name is "babel-preset-xxx", but we prefix all our react stuff then the package become "@company/rdk.babel-preset-xxx".

Now if I try to use it in webpack as:

          {
            loader: 'babel-loader',
            options: {
              presets: ['@company/rdk.babel-preset-xxx'],
            },
          },

THIS BREAKS :( ... with this message:

Error: Cannot find module '@company/babel-preset-rdk.babel-preset-xxx' from ...
- If you want to resolve "@company/rdk.babel-preset-xxx", use "module:@company/rdk.babel-preset-xxx"

As the hint says, prefixing with module: works. But also just suffixing with /. I mean, both options works:
presets: ['module:@company/rdk.babel-preset-xxx'] and/or presets: ['@company/rdk.babel-preset-xxx/']

Is this documented in some place? Could be possible scoped packages different than @babel/ to be resolved using node resolution before Babel's resolution ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    outdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions