Skip to content

Commit f030181

Browse files
author
Fritz Lekschas
committed
Provide proper ESM instead of pointing to the source code.
1 parent cc7a70e commit f030181

2 files changed

Lines changed: 20 additions & 6 deletions

File tree

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@
1111
],
1212
"license": "MIT",
1313
"main": "dist/regl-scatterplot.js",
14-
"module": "src/index.js",
14+
"module": "dist/regl-scatterplot.esm.js",
1515
"files": [
1616
"src/*",
17-
"dist/regl-scatterplot.js",
18-
"dist/regl-scatterplot.min.js"
17+
"dist/*"
1918
],
2019
"scripts": {
2120
"build": "rollup -c; webpack --config ./webpack.config.js --mode production",

rollup.config.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const configurator = (file, format, plugins) => ({
1717
'pub-sub-es': 'createPubSub',
1818
regl: 'createREGL'
1919
},
20-
intro: `var VERSION = ${VERSION};`
20+
intro: `${format === 'es' ? 'const' : 'var'} VERSION = ${VERSION};`
2121
},
2222
plugins,
2323
external: ['pub-sub-es', 'regl']
@@ -31,11 +31,26 @@ const devConfig = configurator('dist/regl-scatterplot.js', 'umd', [
3131
visualizer()
3232
]);
3333

34-
const prodConfig = configurator('dist/regl-scatterplot.js', 'umd', [
34+
const devConfigEsm = configurator('dist/regl-scatterplot.esm.js', 'es', [
35+
resolve(),
36+
commonjs({ sourceMap: false }),
37+
babel(),
38+
filesize(),
39+
visualizer()
40+
]);
41+
42+
const prodConfig = configurator('dist/regl-scatterplot.min.js', 'umd', [
43+
resolve(),
44+
commonjs({ sourceMap: false }),
45+
babel(),
46+
terser()
47+
]);
48+
49+
const prodConfigEsm = configurator('dist/regl-scatterplot.esm.min.js', 'es', [
3550
resolve(),
3651
commonjs({ sourceMap: false }),
3752
babel(),
3853
terser()
3954
]);
4055

41-
export default [devConfig, prodConfig];
56+
export default [devConfig, devConfigEsm, prodConfig, prodConfigEsm];

0 commit comments

Comments
 (0)