Skip to content

Commit

Permalink
Merge pull request #28 from ubie-oss/revert-24-chore-build-config
Browse files Browse the repository at this point in the history
Revert "chore: 🤖 update build config"
  • Loading branch information
takanorip authored Mar 14, 2024
2 parents 5d3f297 + 2aff0a3 commit 9915951
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"name": "@ubie/ubie-ui",
"version": "0.0.3",
"description": "React components for creating Ubie applications.",
"types": "dist/index.d.ts",
"main": "dist/index.js",
"module": "dist/index.mjs",
"typings": "dist/index.d.ts",
"files": [
"README.md",
"dist"
Expand Down
18 changes: 0 additions & 18 deletions tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,5 @@ export default defineConfig({
dts: true,
format: ['cjs', 'esm'],
entry: ['src', '!src/**/*.spec.*', '!src/**/*.d.ts'],
external: ['react'],
bundle: false,
plugins: [
{
name: 'fix-esm',
renderChunk(_, chunk) {
if (this.format === 'esm') {
// https://github.com/egoist/tsup/issues/953
const code = addMjsExtension(chunk.code);
return { code };
}
},
},
],
});

function addMjsExtension(content) {
// This regex looks for relative import paths that don't have a file extension
return content.replace(/from\s+['"](\.\/|\.\.\/)(?![^'"\s]+?\.\w+['"])([^'"\s]+?)['"];/g, "from '$1$2.mjs';");
}

0 comments on commit 9915951

Please sign in to comment.