Skip to content

Commit

Permalink
Revert "fix(nextjs): Fix serializable issue when build with tsup & ts…
Browse files Browse the repository at this point in the history
…up config cleanup"

This reverts commit 7d542df.
  • Loading branch information
nikosdouvlis committed Apr 12, 2023
1 parent af4052e commit 347f6df
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"scripts": {
"prepublishOnly": "npm run build",
"dev": "tsup --watch",
"build": "tsup",
"build:analyze": "tsup --metafile",
"build": "tsup --env.NODE_ENV production",
"build:analyze": "tsup --metafile --env.NODE_ENV production",
"clean": "rimraf ./dist",
"lint": "eslint .",
"test": "jest"
Expand Down
13 changes: 11 additions & 2 deletions packages/nextjs/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { defineConfig } from 'tsup';

export default defineConfig(options => {
import { name, version } from './package.json';

export default defineConfig(overrideOptions => {
const isProd = overrideOptions.env?.NODE_ENV === 'production';

return {
clean: true,
entry: [
Expand All @@ -13,9 +17,14 @@ export default defineConfig(options => {
'src/constants.ts',
],
onSuccess: 'tsc --emitDeclarationOnly --declaration',
minify: !options.watch,
minify: isProd,
sourcemap: true,
format: ['cjs', 'esm'],
define: {
PACKAGE_NAME: `"${name}"`,
PACKAGE_VERSION: `"${version}"`,
__DEV__: `${!isProd}`,
},
legacyOutput: true,
};
});

0 comments on commit 347f6df

Please sign in to comment.