New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: bundle packages to be Ecmascript modules (T-186) #64
Changes from 6 commits
6494f96
4cf390b
62d38ed
c325e71
8fd1dad
393d2fe
746db7a
57899f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
reactStrictMode: true, | ||
// Until the @apollo-client fixes the ESM modules support (https://github.com/apollographql/apollo-feature-requests/issues/287) | ||
// it's required to either transpile the `@lens-protocol` packages or make sure they won't get `imported` during SSR. | ||
transpilePackages: ['@lens-protocol/react', '@lens-protocol/wagmi'], | ||
}; | ||
|
||
module.exports = nextConfig; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
"target": "ESNext", | ||
"useDefineForClassFields": true, | ||
"lib": ["DOM", "DOM.Iterable", "ESNext"], | ||
"allowJs": false, | ||
"allowJs": true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this intentional? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All changes to the |
||
"skipLibCheck": true, | ||
"esModuleInterop": false, | ||
"allowSyntheticDefaultImports": true, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"type": "module", | ||
"main": "../dist/esm/mocks.js" | ||
"main": "../dist/mocks.js" | ||
} |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { defineConfig } from 'tsup'; | ||
|
||
import { dependencies, devDependencies } from './package.json'; | ||
|
||
export default defineConfig({ | ||
entry: ['src/index.ts', 'src/mocks.ts'], | ||
format: ['esm'], | ||
dts: true, | ||
external: [ | ||
...Object.keys(dependencies), | ||
// required to not bundle `jest` into exported mocks | ||
...Object.keys(devDependencies), | ||
], | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"type": "module", | ||
"main": "../dist/esm/entities/index.js" | ||
"main": "../dist/entities/index.js" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export default { | ||
preset: 'ts-jest', | ||
preset: 'ts-jest/presets/js-with-ts', | ||
testEnvironment: 'node', | ||
testPathIgnorePatterns: ['/node_modules/', '/dist/'], | ||
transformIgnorePatterns: [`/node_modules/(?!@lens-protocol/*)`], | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"type": "module", | ||
"main": "../dist/esm/mocks.js" | ||
"main": "../dist/mocks.js" | ||
} |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { defineConfig } from 'tsup'; | ||
|
||
import { dependencies, devDependencies } from './package.json'; | ||
|
||
export default defineConfig({ | ||
entry: [ | ||
'src/index.ts', | ||
'src/mocks.ts', | ||
'src/entities/index.ts', | ||
'src/use-cases/index.ts', | ||
'src/use-cases/**/index.ts', | ||
], | ||
|
||
format: ['esm'], | ||
dts: true, | ||
external: [ | ||
...Object.keys(dependencies), | ||
// required to not bundle `jest` into exported mocks | ||
...Object.keys(devDependencies), | ||
], | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"type": "module", | ||
"main": "../../dist/esm/use-cases/lifecycle/index.js" | ||
"main": "../../dist/use-cases/lifecycle/index.js" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"type": "module", | ||
"main": "../dist/esm/use-cases/index.js" | ||
"main": "../dist/use-cases/index.js" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"type": "module", | ||
"main": "../../dist/esm/use-cases/profile/index.js" | ||
"main": "../../dist/use-cases/profile/index.js" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"type": "module", | ||
"main": "../../dist/esm/use-cases/publications/index.js" | ||
"main": "../../dist/use-cases/publications/index.js" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"type": "module", | ||
"main": "../../dist/esm/use-cases/transactions/index.js" | ||
"main": "../../dist/use-cases/transactions/index.js" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"type": "module", | ||
"main": "../../dist/esm/use-cases/wallets/index.js" | ||
"main": "../../dist/use-cases/wallets/index.js" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
export default { | ||
preset: 'ts-jest', | ||
preset: 'ts-jest/presets/js-with-ts', | ||
testEnvironment: 'jsdom', | ||
testRegex: '/__tests__/.*|(\\.|/)spec\\.tsx?$', | ||
testPathIgnorePatterns: ['/node_modules/', '/dist/'], | ||
transformIgnorePatterns: [`/node_modules/(?!@lens-protocol/*)`], | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no support, for now, to provide route
param
with the handle so it was pointing to a nonexisting route.