Use rollup for bundling.

This commit is contained in:
lishid 2020-10-26 11:58:14 -04:00
parent 5b96e4a095
commit 245339d8e0
3 changed files with 29 additions and 4 deletions

View File

@ -4,15 +4,20 @@
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
"main": "main.js",
"scripts": {
"dev": "tsc --project tsconfig.json -w",
"build": "tsc --project tsconfig.json"
"dev": "rollup --config rollup.config.js -w",
"build": "rollup --config rollup.config.js"
},
"keywords": [],
"author": "",
"license": "MIT",
"devDependencies": {
"obsidian": "https://github.com/obsidianmd/obsidian-api/tarball/master",
"@rollup/plugin-commonjs": "^15.1.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"@rollup/plugin-typescript": "^6.0.0",
"@types/node": "^14.14.2",
"obsidian": "https://github.com/obsidianmd/obsidian-api/tarball/master",
"rollup": "^2.32.1",
"tslib": "^2.0.3",
"typescript": "^4.0.3"
}
}

19
rollup.config.js Normal file
View File

@ -0,0 +1,19 @@
import typescript from '@rollup/plugin-typescript';
import {nodeResolve} from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
export default {
input: 'main.ts',
output: {
dir: '.',
sourcemap: 'inline',
format: 'cjs',
exports: 'default'
},
external: ['obsidian'],
plugins: [
typescript(),
nodeResolve({browser: true}),
commonjs(),
]
};

View File

@ -3,11 +3,12 @@
"baseUrl": ".",
"inlineSourceMap": true,
"inlineSources": true,
"module": "CommonJS",
"module": "ESNext",
"target": "es5",
"allowJs": true,
"noImplicitAny": true,
"moduleResolution": "node",
"importHelpers": true,
"lib": [
"dom",
"es5",