Skip to content

Commit

Permalink
fix(): Suppress module directive warnings and export sourcemap.
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanCQ committed Dec 20, 2023
1 parent 293c1ed commit d5a3dc7
Showing 1 changed file with 33 additions and 30 deletions.
63 changes: 33 additions & 30 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,37 @@ import peerDepsExternal from "rollup-plugin-peer-deps-external";
import preserveDirectives from "rollup-plugin-preserve-directives";
import { terser } from "rollup-plugin-terser";

export default [
{
input: "src/index.ts",
output: [
{
dir: "dist/",
format: "esm",
preserveModules: true,
},
],
plugins: [
peerDepsExternal(),
// Locate modules using the Node resolution algorithm
resolve(),
// Convert CommonJS modules to ES6.
commonjs(),
// Create typescript definitions.
typescript({
tsconfig: "./tsconfig.json",
declarationDir: "./dist/types",
}),
// CSS vendor prefixing etc.
copy({
targets: [{ src: "./src/tokens.css", dest: "./dist" }],
}),
// Minify output.
terser({ compress: { directives: false } }),
preserveDirectives(),
],
export default {
onwarn(warning, warn) {
if (
warning.code === "MODULE_LEVEL_DIRECTIVE" &&
warning.message.includes(`'use client'`)
) {
return;
}
warn(warning);
},
];
input: "src/index.ts",
output: [
{
dir: "dist/",
format: "esm",
preserveModules: true,
sourcemap: true,
},
],
plugins: [
peerDepsExternal(),
resolve(),
commonjs(),
typescript({
tsconfig: "./tsconfig.json",
declarationDir: "./dist/types",
}),
copy({
targets: [{ src: "./src/tokens.css", dest: "./dist" }],
}),
terser({ compress: { directives: false } }),
preserveDirectives(),
],
};

0 comments on commit d5a3dc7

Please sign in to comment.