Skip to content

Commit

Permalink
Use rollup for bundling.
Browse files Browse the repository at this point in the history
  • Loading branch information
lishid committed Oct 26, 2020
1 parent 5b96e4a commit 245339d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 19 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -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(),
]
};
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 245339d

Please sign in to comment.