Skip to content

Commit 4584852

Browse files
author
Larry Botha
committed
chore(rollup): configure rollup to work with svelte-preprocess
1 parent 5baad2f commit 4584852

File tree

4 files changed

+142
-71
lines changed

4 files changed

+142
-71
lines changed

package-lock.json

Lines changed: 99 additions & 58 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,21 @@
1414
"format": "prettier --write lib/**/*.{js,svelte}",
1515
"commit": "git-cz"
1616
},
17-
"files": ["build/*", "lib/*"],
17+
"files": [
18+
"build/*",
19+
"lib/*"
20+
],
1821
"svelte": "./lib/index.js",
1922
"author": "Tjin Au Yeung",
20-
"browserslist": ["last 1 chrome versions"],
21-
"keywords": ["svelte", "forms", "validation", "form-validation"],
23+
"browserslist": [
24+
"last 1 chrome versions"
25+
],
26+
"keywords": [
27+
"svelte",
28+
"forms",
29+
"validation",
30+
"form-validation"
31+
],
2232
"repository": {
2333
"type": "git",
2434
"url": "https://github.com/tjinauyeung/svelte-forms-lib"
@@ -35,6 +45,7 @@
3545
"@babel/preset-env": "^7.12.11",
3646
"@commitlint/cli": "^11.0.0",
3747
"@commitlint/config-conventional": "^11.0.0",
48+
"@rollup/plugin-typescript": "^8.2.0",
3849
"@testing-library/jest-dom": "^5.11.9",
3950
"@testing-library/svelte": "^3.0.3",
4051
"@types/chance": "1.1.1",
@@ -66,6 +77,8 @@
6677
"svelte-fragment-component": "^1.2.0",
6778
"svelte-jester": "^1.3.0",
6879
"svelte-jsx": "^2.0.0",
80+
"svelte-preprocess": "^4.6.9",
81+
"typescript": "^4.2.3",
6982
"yup": "0.32.8"
7083
},
7184
"config": {

rollup.config.js

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
1-
import commonjs from "rollup-plugin-commonjs";
2-
import resolve from "rollup-plugin-node-resolve";
3-
import svelte from "rollup-plugin-svelte";
1+
import commonjs from 'rollup-plugin-commonjs';
2+
import resolve from 'rollup-plugin-node-resolve';
3+
import svelte from 'rollup-plugin-svelte';
4+
import typescript from '@rollup/plugin-typescript';
5+
6+
import svelteConfig from './svelte.config';
47

58
export default {
6-
input: "./lib/index.js",
9+
input: './lib/index.js',
710
output: [
811
{
912
file: `./build/index.mjs`,
10-
format: "esm",
11-
paths: id => id.startsWith("svelte/") && `${id.replace("svelte", ".")}`
13+
format: 'esm',
14+
paths: (id) => id.startsWith('svelte/') && `${id.replace('svelte', '.')}`,
1215
},
1316
{
1417
file: `./build/index.js`,
15-
format: "cjs",
16-
paths: id => id.startsWith("svelte/") && `${id.replace("svelte", ".")}`
17-
}
18+
format: 'cjs',
19+
paths: (id) => id.startsWith('svelte/') && `${id.replace('svelte', '.')}`,
20+
},
21+
],
22+
plugins: [
23+
typescript(),
24+
svelte({
25+
...svelteConfig,
26+
}),
27+
resolve(),
28+
commonjs(),
1829
],
19-
plugins: [svelte(), resolve(), commonjs()]
2030
};

svelte.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const preprocess = require('svelte-preprocess');
2+
3+
const config = {
4+
preprocess: preprocess(),
5+
};
6+
7+
module.exports = config;

0 commit comments

Comments
 (0)