commit 245339d8e08567a490df8dd5c2d25014539a8f99
parent 5b96e4a0951ecb436b6d8fb484bbbaeab32fe092
Author: lishid <lishid@gmail.com>
Date: Mon, 26 Oct 2020 11:58:14 -0400
Use rollup for bundling.
Diffstat:
3 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/package.json b/package.json
@@ -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"
}
}
diff --git a/rollup.config.js b/rollup.config.js
@@ -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(),
+ ]
+};
+\ No newline at end of file
diff --git a/tsconfig.json b/tsconfig.json
@@ -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",