Skip to content

Commit

Permalink
fix: add esm dist for import
Browse files Browse the repository at this point in the history
close #18
  • Loading branch information
weizhenye committed Jul 29, 2024
1 parent 7fe5e67 commit 20a9e74
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"version": "0.1.12",
"type": "module",
"description": "Parses and compiles ASS subtitle format to easy-to-use data structure.",
"main": "dist/ass-compiler.js",
"module": "src/index.js",
"main": "dist/esm/ass-compiler.js",
"module": "dist/esm/ass-compiler.js",
"sideEffects": false,
"files": [
"dist",
Expand All @@ -19,7 +19,7 @@
"test": "npm run lint && npm run unit",
"dev": "rollup -c -w",
"bundle": "rollup -c",
"minify": "uglifyjs dist/ass-compiler.js -m -o dist/ass-compiler.min.js",
"minify": "uglifyjs dist/ass-compiler.js -m -o dist/ass-compiler.min.js && uglifyjs dist/esm/ass-compiler.js -m -o dist/esm/ass-compiler.min.js",
"build": "npm run bundle && npm run minify",
"preversion": "npm test",
"version": "npm run build && git add -A ./dist",
Expand Down
16 changes: 11 additions & 5 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ import replace from 'rollup-plugin-replace';

export default {
input: 'src/index.js',
output: {
file: 'dist/ass-compiler.js',
format: 'umd',
name: 'assCompiler',
},
output: [
{
file: 'dist/esm/ass-compiler.js',
format: 'esm',
},
{
file: 'dist/ass-compiler.js',
format: 'umd',
name: 'assCompiler',
}
],
plugins: [
buble(),
replace({
Expand Down

0 comments on commit 20a9e74

Please sign in to comment.