Skip to content

Commit

Permalink
build: 0.10.6
Browse files Browse the repository at this point in the history
add index.esm.js to fix #142

#142
  • Loading branch information
toxic-johann committed Aug 12, 2018
1 parent c18f8f7 commit 7d102fa
Show file tree
Hide file tree
Showing 16 changed files with 16,289 additions and 393 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ You will find four different builds in the lib.
| index.mjs | esmodule | An es module, mostly used in Webpack 2 and rollup. | Yes |
| index.browser.js | umd | Can be used directly in browser | No (It's in development) |
| index.min.js | umd | Can be used directly in browser | No (It's in production) |
| Index.esm.js | esmodule | An es module, mostly used in browser es module | No (It's in development) |

## Development

Expand Down
25 changes: 23 additions & 2 deletions build/rollup.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,27 @@ const babelConfig = {
runtimeHelpers: true,
babelrc: false,
},
esm: {
presets: [
'flow',
[ 'env', {
modules: false,
targets: {
browsers: [ 'last 2 versions', 'not ie <= 8' ],
},
}],
'stage-0',
],
exclude: 'node_modules/**',
plugins: [
'external-helpers',
'transform-decorators-legacy',
'transform-runtime',
],
externalHelpers: true,
runtimeHelpers: true,
babelrc: false,
},
umd: {
presets: [
'flow',
Expand Down Expand Up @@ -122,7 +143,7 @@ export default function(mode) {
return {
input: 'src/index.js',
external(id) {
return !/min|umd|iife/.test(mode) && externalRegExp.test(id);
return !/min|umd|iife|esm/.test(mode) && externalRegExp.test(id);
},
plugins: [
babel(babelConfig[mode]),
Expand All @@ -133,7 +154,7 @@ export default function(mode) {
}),
resolve({
customResolveOptions: {
moduleDirectory: /min|umd|iife/.test(mode) ? [ 'src', 'node_modules' ] : [ 'src' ],
moduleDirectory: /min|umd|iife|esm/.test(mode) ? [ 'src', 'node_modules' ] : [ 'src' ],
},
}),
visualizer({
Expand Down
13 changes: 13 additions & 0 deletions build/rollup.config.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import base, { banner } from './rollup.config.base';
import replace from 'rollup-plugin-replace';
const config = base('esm');
config.plugins.unshift(replace({
'process.env.NODE_ENV': '"development"',
}));
export default Object.assign(config, {
output: {
format: 'es',
file: 'lib/index.esm.js',
banner,
},
});
Loading

0 comments on commit 7d102fa

Please sign in to comment.