systemjs / plugin-babel

SystemJS Babel Plugin
MIT License
83 stars 33 forks source link

How to use babel plugins (dev only)? #83

Open sookoll opened 7 years ago

sookoll commented 7 years ago

I tried to use babel-plugin-wildcard. JSPM by default load babel and es6 modules into browser and then transpile. I guess that wildcard plugin needs to access file system to determine modules. So only option was server-side transpiling also in development mode. Tried development bundling as described here: https://jspm.io/0.17-beta-guide/development-bundling.html with no luck.

$ jspm install --dev npm:babel-plugin-wildcard
SystemJS.config({
  ...
  meta: {
    '*.js': {
      babelOptions: {
        plugins: ['babel-plugin-wildcard']
      }
    }
  }
});

command to transpile bundle:

$ jspm bundle src/main.js src/build.js -id

It never recognize, that it should use wildcard plugin for transpile imports. Any quidance?

aluanhaddad commented 7 years ago

The docs for that plugin show the name of the plugin as "wildcard" when passed to Babel.

Try this (untested):

$ jspm install --dev wildcard=npm:babel-plugin-wildcard

and in your configuration

SystemJS.config({
  meta: {
    '*.js': {
      babelOptions: {
        plugins: ['wildcard']
      }
    }
  }
});