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

Support of babel 6 and babel 7  #14

@igor-dv

Description

@igor-dv

Hey,

I would like to use this package in Storybook. In my PR here, I've temporarily copied the code in order to make a progress.

The problem is that Sotrybook has a peer of bable-loader in order to allow people still to use babel 6.
That means, we can't be dependant on a package that is directly dependant on @babel/core.
So I've created a babel-core-proxy that does something like this:

/* eslint-disable import/no-extraneous-dependencies,global-require */
let babelCore = null;

try {
  babelCore = require('@babel/core');
} catch (e) {
  babelCore = require('babel-core');
}

module.exports = babelCore;

And then used it in the babel-merge code:

import { resolvePlugin, resolvePreset } from './babel-core-proxy';

Will you consider this change as a pull request ?

The downside of this approach is that babel-core and @babel/core can't be in a list of peerDeps, but it's something that can be documented 🤷‍♂️

Thanks.

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