Skip to content

Commit

Permalink
Move rollup config to ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
NSeydoux committed Oct 13, 2022
1 parent 2d4f438 commit af0f9eb
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "1.23.3",
"license": "MIT",
"scripts": {
"build": "rollup --config rollup.config.js",
"build": "rollup --config rollup.config.mjs",
"docs:clean": "cd docs/api; make clean-all",
"docs:install": "cd docs/api; pip install -r requirements.txt",
"docs:build": "typedoc && cd docs/api && make html dist",
Expand Down
56 changes: 56 additions & 0 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// The following is only possible from Node 18 onwards
// import pkg from "./package.json" assert { type: "json" };

// Until we only support Node 18+, this should be used instead
// (see https://rollupjs.org/guide/en/#importing-packagejson)
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const pkg = require('./package.json');

import typescript from "rollup-plugin-typescript2";

export default {
input: "./src/index.ts",
output: [
{
file: pkg.main,
format: "cjs",
},
{
file: pkg.module,
entryFileNames: "[name].es.js",
format: "esm",
},
{
dir: "dist",
entryFileNames: "[name].mjs",
format: "esm",
preserveModules: true,
},
{
dir: "umd",
format: "umd",
name: "SolidClient",
},
],
plugins: [
typescript({
// Use our own version of TypeScript, rather than the one bundled with the plugin:
typescript: require("typescript"),
tsconfigOverride: {
// Exclude tests:
exclude: ["**/*.test.ts"],
compilerOptions: {
module: "esnext",
},
},
}),
],
external: [
"cross-fetch",
"http-link-header",
"@rdfjs/dataset",
"n3",
"jsonld",
],
};

0 comments on commit af0f9eb

Please sign in to comment.