Skip to content

Commit bf1ff0e

Browse files
committed
improve infra, export an es5 build by default
1 parent 79bf0fa commit bf1ff0e

File tree

14 files changed

+11382
-294
lines changed

14 files changed

+11382
-294
lines changed

.babelrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"env": {
3+
"development": {
4+
"presets": ["es2016", "es2017", "stage-0"]
5+
},
6+
"test": {
7+
"presets": ["es2016", "es2017", "stage-0"],
8+
"plugins": ["transform-es2015-modules-commonjs"]
9+
}
10+
}
11+
}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,6 @@ jspm_packages
3838

3939
# reify cache for allowing import export in node
4040
.reify-cache
41+
42+
# built code
43+
dist

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,17 @@ compiler.hide('console', 'Math')
180180
code({num: 1.8}) // throws an error, console and Math are undefined
181181
```
182182

183+
## Alternative builds
184+
185+
This library detects if you use ES or commonJS modules and serve the right format to you. The exposed bundles are transpiled to ES5 to support common tools - like UglifyJS. If you would like a finer control over the provided build, you can specify them in your imports.
186+
187+
* `@nx-js/compiler-util/dist/es.es6.js` exposes an ES6 build with ES modules.
188+
* `@nx-js/compiler-util/dist/es.es5.js` exposes an ES5 build with ES modules.
189+
* `@nx-js/compiler-util/dist/cjs.es6.js` exposes an ES6 build with commonJS modules.
190+
* `@nx-js/compiler-util/dist/cjs.es5.js` exposes an ES5 build with commonJS modules.
191+
192+
If you use a bundler, set up an alias for `@nx-js/compiler-util` to point to your desired build. You can learn how to do it with webpack [here](https://webpack.js.org/configuration/resolve/#resolve-alias) and with rollup [here](https://github.com/rollup/rollup-plugin-alias#usage).
193+
183194
## Contributions
184195

185196
This library has the very specific purpose of supporting the

dist/compiler.js

Lines changed: 0 additions & 223 deletions
This file was deleted.

0 commit comments

Comments
 (0)