Skip to content

Commit ed55b77

Browse files
authored
Merge pull request #10 from stoplightio/fix-esm
2 parents c5fbeae + 7d37472 commit ed55b77

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ echo 'extends: ["@stoplight/spectral-documentation"]' > .spectral.yaml
2525
_If you're using VS Code or Stoplight Studio then the NPM modules will not be available. Instead you can use the CDN hosted version:_
2626

2727
```
28-
echo 'extends: ["https://unpkg.com/@stoplight/spectral-documentation@1.0.0/dist/ruleset.js"]' > .spectral.yaml
28+
echo 'extends: ["https://unpkg.com/@stoplight/spectral-documentation/dist/ruleset.mjs"]' > .spectral.yaml
2929
```
3030

3131
_**Note:** You need to use the full URL with CDN hosted rulesets because Spectral [cannot follow redirects through extends](https://github.com/stoplightio/spectral/issues/2266)._

package.json

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -48,26 +48,5 @@
4848
"ts-jest": "^28.0",
4949
"tsup": "^6.2.3",
5050
"typescript": "^4.8.4"
51-
},
52-
"tsup": {
53-
"entry": [
54-
"src/ruleset.ts"
55-
],
56-
"clean": true,
57-
"dts": true,
58-
"format": [
59-
"cjs",
60-
"esm"
61-
],
62-
"sourcemap": true,
63-
"noExternal": [
64-
"@stoplight/types"
65-
],
66-
"external": [
67-
"@stoplight/spectral-core"
68-
],
69-
"footer": {
70-
"js": "module.exports = module.exports.default;"
71-
}
7251
}
7352
}

tsup.config.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import type { Options } from 'tsup';
2+
3+
export default <Options>{
4+
entry: ["src/ruleset.ts"],
5+
clean: true,
6+
dts: true,
7+
target: "es2018",
8+
format: ["cjs", "esm"],
9+
sourcemap: true,
10+
noExternal: ["@stoplight/types"],
11+
external: ["@stoplight/spectral-core"],
12+
footer({ format }) {
13+
if (format === "cjs") {
14+
return {
15+
js: "module.exports = module.exports.default;",
16+
};
17+
}
18+
19+
return {};
20+
},
21+
};

0 commit comments

Comments
 (0)