Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow configuration of ES6 transpilation and polyfills #4

Closed
indianscout opened this issue Mar 31, 2016 · 4 comments
Closed

Allow configuration of ES6 transpilation and polyfills #4

indianscout opened this issue Mar 31, 2016 · 4 comments
Assignees

Comments

@indianscout
Copy link

The current code does only browserify the module without polyfills and transpilation of recent JS/ES6 features. This could easily be achieved by providing the according babelify options browserify().transform(). The following quick and dirty workaround in index.js, line 42 works in my case but is very specific for my use case:

var b = browserify(
  options.file, 
  {standalone: options.namespace}
).transform(
  "babelify",
  {
    presets: ["es2015"],
    plugins: [
      "transform-class-properties", 
      "transform-object-rest-spread", 
      "transform-array-from"
    ]
  }
);

The best would be to include an cli option (-b, --babelify) with a json file containing the babelify configuration (similar to -e).

@jrmerz jrmerz self-assigned this Mar 31, 2016
jrmerz added a commit that referenced this issue Mar 31, 2016
@jrmerz
Copy link
Member

jrmerz commented Mar 31, 2016

-b, --babelify option added. @indianscout you mind testing (I only did super simple test). If all looks good, I will publish change to npm. If you find any issue, you mind fixing and making pull request?

@indianscout
Copy link
Author

I'll do some more testing. THX for the quick fix :-)

@indianscout
Copy link
Author

Test with -b and --babelify option looks good (also with relative path):

indianscout@indianscout45:~/infektweb/guidelines.v4/web/app/utils/stateFromHTML$ node ~/sandbox/es6-to-plv8/cmd.js -n DetailContentMigration -f stateFromHTML.js -o stateFromHTML -e ~/infektweb/guidelines.v4/web/app/utils/stateFromHTML/stateFromHTML.json --babelify babelify.json 
{ namespace: 'DetailContentMigration',
  file: 'stateFromHTML.js',
  outfile: 'stateFromHTML',
  wrappers: '',
  definitions: '/home/indianscout/infektweb/guidelines.v4/web/app/utils/stateFromHTML/stateFromHTML.json',
  babelify: 'babelify.json',
  watch: false,
  db: false }
>>>> Building PLV8 sql file...
indianscout@indianscout45:~/infektweb/guidelines.v4/web/app/utils/stateFromHTML$ node ~/sandbox/es6-to-plv8/cmd.js -n DetailContentMigration -f stateFromHTML.js -o stateFromHTML -e ~/infektweb/guidelines.v4/web/app/utils/stateFromHTML/stateFromHTML.json -b babelify.json 
{ namespace: 'DetailContentMigration',
  file: 'stateFromHTML.js',
  outfile: 'stateFromHTML',
  wrappers: '',
  definitions: '/home/indianscout/infektweb/guidelines.v4/web/app/utils/stateFromHTML/stateFromHTML.json',
  babelify: 'babelify.json',
  watch: false,
  db: false }
>>>> Building PLV8 sql file...

THX 👍

@jrmerz
Copy link
Member

jrmerz commented Apr 1, 2016

awesome. pushed update to npm. 0.0.2

@jrmerz jrmerz closed this as completed Apr 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants