fuman/es6bundler

Es6Bundler is an ES6 bundler written in PHP

0.0.2 2021-11-16 17:22 UTC

This package is not auto-updated.

Last update: 2025-07-09 10:42:25 UTC


README

A ES6 bundler written in PHP.

This bundler tries to change only the import and export statements and ignore the rest. As we do not have to parse the source code completely, it should be possible to create a performant script.

Unsupported exports

Until now, comma separated exports (shorthand version) is not supported. As we need there a nice way to parse javascript including all possible expressions.

Todo

Detecting comma-separated exports and throwing an informative exception about this is not supported.

Usage

$bundler = new \Fuman\Es6Builder\Bundler(new \Fuman\Es6Builder\Config('path/to/web/root/', ['bundle1', 'library/bundle2']));
$transformedAndPackedSource = $bundler->transformFile('path/to/file.js');