Skip to content

[feature request] include dynamic import syntax plugin automatically #515

@hzoo

Description

@hzoo

I've written/talked about this before a few times, might as well make it an issue.

We shouldn't have to ask users to include the dynamic import plugin if webpack is supporting it and is a source of pain. Ideally it would work with preset-env where webpack is it's own target or something but this is already babel-loader so we know that a user is using webpack + babel together. We could just make it a dependency (or just use parserOpts: { plugins: ['dynamicImport'] } and no dependency necessary).

So like at

babel-loader/src/index.js

Lines 128 to 129 in 1ca5c78

const defaultOptions = {
metadataSubscribers: [],

const defaultOptions = {
+  parserOpts: { plugins: ['dynamicImport'] },

Or we'd have to do append the plugin to the end of the plugins:

options.plugins.push(require('babel-plugin-syntax-dynamic-import'))

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions