web: Add config to support npm module

This commit is contained in:
Jinny You 2023-12-15 16:45:30 +09:00 committed by Hermet Park
parent e67add4d87
commit d5f141ce14
3 changed files with 25 additions and 8 deletions

View file

@ -2,7 +2,21 @@
"name": "@thorvg/lottie-player",
"version": "1.0.0-beta.0",
"description": "A web lottie player using ThorVG as a renderer",
"main": "index.js",
"main": "./dist/lottie-player.cjs.js",
"module": "./dist/lottie-player.esm.js",
"exports": {
".": {
"import": "./dist/lottie-player.cjs.js",
"require": "./dist/lottie-player.esm.js"
}
},
"publishConfig": {
"access": "public"
},
"files": [
"dist/"
],
"types": "./dist/lottie-player.d.ts",
"scripts": {
"build": "npm run clean && npm run copy:wasm && THORVG_VERSION=$(sed -n -e 4p ../meson.build | sed 's/..$//' | sed -r 's/.{19}//') rollup -c --bundleConfigAsCjs && rm -rf ./dist/thorvg-wasm.js",
"build:watch": "npm run clean && npm run copy:wasm && rollup -c --bundleConfigAsCjs --watch",
@ -44,9 +58,11 @@
"rollup-plugin-dts": "^6.1.0",
"rollup-plugin-polyfill-node": "^0.13.0",
"rollup-plugin-swc3": "^0.10.4",
"rollup-plugin-terser": "^7.0.2",
"typescript": "*"
},
"dependencies": {
"lit": "^3.1.0"
"lit": "^3.1.0",
"url": "^0.11.3"
}
}

View file

@ -7,10 +7,11 @@ import nodePolyfills from 'rollup-plugin-polyfill-node';
import bakedEnv from 'rollup-plugin-baked-env';
import pkg from './package.json';
const extensions = [".js", ".jsx", ".ts", ".tsx", ".mjs", ".wasm"];
const name = 'lottie-player';
const globals = {
'lit': 'lit',
'lit/decorators.js': 'lit/decorators.js',
url: "url",
lit: "lit",
"lit/decorators.js": "lit/decorators.js",
};
export default [

View file

@ -32,11 +32,11 @@
"skipLibCheck": true
},
"include": [
"src/**/*.ts",
"types/**/*.ts"
"src/**/*.ts"
],
"exclude": [
"node_modules",
"dist",
"example",
"dist"
],
}