Skip to content
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

Building with vite (Rollup) (vue-ts) gives 17 build problems #4633

Closed
JonasWijne opened this issue Mar 6, 2022 · 8 comments
Closed

Building with vite (Rollup) (vue-ts) gives 17 build problems #4633

JonasWijne opened this issue Mar 6, 2022 · 8 comments
Labels
stale Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance.

Comments

@JonasWijne
Copy link

Hi, i am using polkadot api and in dev everything seems to work but when i try to build i get following errors.
can you identify what i am doing wrong, i looked into your FAQ and docs but can't seem to pinpoint my issue/ solution.

i made a repo so i can isolate my problem https://github.com/JonasWijne/polkadot_build_issue
just clone and yarn install followed by yarn build

node_modules/@polkadot/api-derive/balances/types.d.ts:3:15 - error TS2305: Module '"@polkadot/types/lookup"' has no exported member 'PalletBalancesBalanceLock'.

3 import type { PalletBalancesBalanceLock, PalletBalancesReserveData } from '@polkadot/types/lookup';
                ~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@polkadot/api-derive/balances/types.d.ts:3:42 - error TS2305: Module '"@polkadot/types/lookup"' has no exported member 'PalletBalancesReserveData'.

3 import type { PalletBalancesBalanceLock, PalletBalancesReserveData } from '@polkadot/types/lookup';
                                           ~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@polkadot/api-derive/democracy/referendumsFinished.d.ts:2:15 - error TS2305: Module '"@polkadot/types/lookup"' has no exported member 'PalletDemocracyReferendumInfo'.

2 import type { PalletDemocracyReferendumInfo } from '@polkadot/types/lookup';
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@polkadot/api-derive/democracy/referendumsInfo.d.ts:5:15 - error TS2305: Module '"@polkadot/types/lookup"' has no exported member 'PalletDemocracyReferendumInfo'.

5 import type { PalletDemocracyReferendumInfo } from '@polkadot/types/lookup';
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@polkadot/api-derive/democracy/types.d.ts:4:15 - error TS2305: Module '"@polkadot/types/lookup"' has no exported member 'PalletDemocracyReferendumStatus'.

4 import type { PalletDemocracyReferendumStatus, PalletDemocracyVoteThreshold } from '@polkadot/types/lookup';
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@polkadot/api-derive/democracy/types.d.ts:4:48 - error TS2305: Module '"@polkadot/types/lookup"' has no exported member 'PalletDemocracyVoteThreshold'.

4 import type { PalletDemocracyReferendumStatus, PalletDemocracyVoteThreshold } from '@polkadot/types/lookup';
                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@polkadot/api-derive/society/types.d.ts:3:15 - error TS2305: Module '"@polkadot/types/lookup"' has no exported member 'PalletSocietyBid'.

3 import type { PalletSocietyBid, PalletSocietyBidKind, PalletSocietyVote, PalletSocietyVouchingStatus } from '@polkadot/types/lookup';
                ~~~~~~~~~~~~~~~~

node_modules/@polkadot/api-derive/society/types.d.ts:3:33 - error TS2305: Module '"@polkadot/types/lookup"' has no exported member 'PalletSocietyBidKind'.

3 import type { PalletSocietyBid, PalletSocietyBidKind, PalletSocietyVote, PalletSocietyVouchingStatus } from '@polkadot/types/lookup';
                                  ~~~~~~~~~~~~~~~~~~~~

node_modules/@polkadot/api-derive/society/types.d.ts:3:55 - error TS2305: Module '"@polkadot/types/lookup"' has no exported member 'PalletSocietyVote'.

3 import type { PalletSocietyBid, PalletSocietyBidKind, PalletSocietyVote, PalletSocietyVouchingStatus } from '@polkadot/types/lookup';
                                                        ~~~~~~~~~~~~~~~~~

node_modules/@polkadot/api-derive/society/types.d.ts:3:74 - error TS2305: Module '"@polkadot/types/lookup"' has no exported member 'PalletSocietyVouchingStatus'.

3 import type { PalletSocietyBid, PalletSocietyBidKind, PalletSocietyVote, PalletSocietyVouchingStatus } from '@polkadot/types/lookup';
                                                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@polkadot/api-derive/staking/currentPoints.d.ts:2:15 - error TS2305: Module '"@polkadot/types/lookup"' has no exported member 'PalletStakingEraRewardPoints'.

2 import type { PalletStakingEraRewardPoints } from '@polkadot/types/lookup';
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@polkadot/api-derive/staking/types.d.ts:3:15 - error TS2305: Module '"@polkadot/types/lookup"' has no exported member 'PalletStakingExposure'.

3 import type { PalletStakingExposure, PalletStakingRewardDestination, PalletStakingStakingLedger, PalletStakingValidatorPrefs } from '@polkadot/types/lookup';
                ~~~~~~~~~~~~~~~~~~~~~

node_modules/@polkadot/api-derive/staking/types.d.ts:3:38 - error TS2305: Module '"@polkadot/types/lookup"' has no exported member 'PalletStakingRewardDestination'.

3 import type { PalletStakingExposure, PalletStakingRewardDestination, PalletStakingStakingLedger, PalletStakingValidatorPrefs } from '@polkadot/types/lookup';
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@polkadot/api-derive/staking/types.d.ts:3:70 - error TS2305: Module '"@polkadot/types/lookup"' has no exported member 'PalletStakingStakingLedger'.

3 import type { PalletStakingExposure, PalletStakingRewardDestination, PalletStakingStakingLedger, PalletStakingValidatorPrefs } from '@polkadot/types/lookup';
                                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@polkadot/api-derive/staking/types.d.ts:3:98 - error TS2305: Module '"@polkadot/types/lookup"' has no exported member 'PalletStakingValidatorPrefs'.

3 import type { PalletStakingExposure, PalletStakingRewardDestination, PalletStakingStakingLedger, PalletStakingValidatorPrefs } from '@polkadot/types/lookup';
                                                                                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@polkadot/api-derive/types.d.ts:5:15 - error TS2305: Module '"@polkadot/types/lookup"' has no exported member 'PalletBountiesBounty'.

5 import type { PalletBountiesBounty, PalletTreasuryProposal } from '@polkadot/types/lookup';
                ~~~~~~~~~~~~~~~~~~~~

node_modules/@polkadot/api-derive/types.d.ts:5:37 - error TS2305: Module '"@polkadot/types/lookup"' has no exported member 'PalletTreasuryProposal'.

5 import type { PalletBountiesBounty, PalletTreasuryProposal } from '@polkadot/types/lookup';
                                      ~~~~~~~~~~~~~~~~~~~~~~


Found 17 errors in 8 files.

Errors  Files
     2  node_modules/@polkadot/api-derive/balances/types.d.ts:3
     1  node_modules/@polkadot/api-derive/democracy/referendumsFinished.d.ts:2
     1  node_modules/@polkadot/api-derive/democracy/referendumsInfo.d.ts:5
     2  node_modules/@polkadot/api-derive/democracy/types.d.ts:4
     4  node_modules/@polkadot/api-derive/society/types.d.ts:3
     1  node_modules/@polkadot/api-derive/staking/currentPoints.d.ts:2
     4  node_modules/@polkadot/api-derive/staking/types.d.ts:3
     2  node_modules/@polkadot/api-derive/types.d.ts:5
error Command failed with exit code 2.
@JonasWijne JonasWijne changed the title building with vite (vue-ts) gives 17 build problems Building with vite (vue-ts) gives 17 build problems Mar 6, 2022
@JonasWijne JonasWijne changed the title Building with vite (vue-ts) gives 17 build problems Building with vite (Rollup) (vue-ts) gives 17 build problems Mar 6, 2022
@jacogr
Copy link
Member

jacogr commented Mar 6, 2022

See https://github.com/polkadot-js/api/releases/tag/v7.0.1 (First CHANGELOG entry pointing to the FAQ aka https://polkadot.js.org/docs/api/FAQ/#since-upgrading-to-the-7x-series-typescript-augmentation-is-missing)

@jacogr jacogr added duplicate Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance. labels Mar 6, 2022
@JonasWijne
Copy link
Author

i thank you good sir, it works now.

one more question, i get Uncaught TypeError: Failed to construct 'URL': Invalid URL after building and serving
i have a dirty fix by changing the source code of all the packageInfo.js "prebuild": "find ./node_modules/@polkadot -type f -name 'packageInfo.js' | xargs sed -i \"s/URL('.', import.meta.url).pathname,/String('path'),/\""
i saw this on the FAQ but i don't think this specifically is the problem, can you help, should i make another issue ?

@jacogr
Copy link
Member

jacogr commented Mar 6, 2022

Could you log import.meta.url there to see what the bundler puts in?

@JonasWijne
Copy link
Author

sorry i commented before testing, i get:

yarn build && yarn serve       
yarn run v1.22.11
$ vue-tsc --noEmit && vite build
vite v2.8.6 building for production...
✓ 17 modules transformed.
[vite:asset-import-meta-url] EISDIR: illegal operation on a directory, read
file: /home/jonaswijne/research/polkadotapi_issue/node_modules/@polkadot/api-augment/packageInfo.js
error during build:
Error: EISDIR: illegal operation on a directory, read
[!] Error: unfinished hook action(s) on exit:
(vite:css) transform "/home/jonaswijne/research/polkadotapi_issue/src/App.vue?vue&type=style&index=0&lang.css"
(vite:load-fallback) load "/home/jonaswijne/research/polkadotapi_issue/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js"
(vite:load-fallback) load "/home/jonaswijne/research/polkadotapi_issue/node_modules/@polkadot/api-augment/base.js"
(vite:load-fallback) load "/home/jonaswijne/research/polkadotapi_issue/node_modules/@polkadot/api-augment/substrate/consts.js"
(vite:load-fallback) load "/home/jonaswijne/research/polkadotapi_issue/node_modules/@polkadot/api-augment/substrate/errors.js"
(vite:load-fallback) load "/home/jonaswijne/research/polkadotapi_issue/node_modules/@polkadot/api-augment/substrate/events.js"
(vite:load-fallback) load "/home/jonaswijne/research/polkadotapi_issue/node_modules/@polkadot/api-augment/substrate/query.js"
(vite:load-fallback) load "/home/jonaswijne/research/polkadotapi_issue/node_modules/@polkadot/api-augment/substrate/tx.js"
(vite:vue) transform "/home/jonaswijne/research/polkadotapi_issue/src/components/HelloPolkadot.vue"
(vite:load-fallback) load "/home/jonaswijne/research/polkadotapi_issue/node_modules/@polkadot/util/detectOther.js"
(vite:load-fallback) load "/home/jonaswijne/research/polkadotapi_issue/node_modules/@polkadot/util/packageInfo.js"
(vite:load-fallback) load "/home/jonaswijne/research/polkadotapi_issue/node_modules/@polkadot/util/versionDetect.js"
(vite:load-fallback) load "/home/jonaswijne/research/polkadotapi_issue/node_modules/@polkadot/util/array/index.js"
(vite:load-fallback) load "/home/jonaswijne/research/polkadotapi_issue/node_modules/@polkadot/util/assert.js"
(vite:load-fallback) load "/home/jonaswijne/research/polkadotapi_issue/node_modules/@polkadot/util/bi/index.js"
(vite:load-fallback) load "/home/jonaswijne/research/polkadotapi_issue/node_modules/@polkadot/util/bn/index.js"
(vite:load-fallback) load "/home/jonaswijne/research/polkadotapi_issue/node_modules/@polkadot/util/buffer/index.js"
(vite:load-fallback) load "/home/jonaswijne/research/polkadotapi_issue/node_modules/@polkadot/util/compact/index.js"
(vite:load-fallback) load "/home/jonaswijne/research/polkadotapi_issue/node_modules/@polkadot/util/extractTime.js"
(vite:load-fallback) load "/home/jonaswijne/research/polkadotapi_issue/node_modules/@polkadot/util/format/index.js"
(vite:asset-import-meta-url) transform "/home/jonaswijne/research/polkadotapi_issue/node_modules/@polkadot/api-base/packageInfo.js"
(vite:load-fallback) load "/home/jonaswijne/research/polkadotapi_issue/node_modules/@polkadot/util/has.js"
(vite:asset-import-meta-url) transform "/home/jonaswijne/research/polkadotapi_issue/node_modules/@polkadot/types/packageInfo.js"
(vite:load-fallback) load "/home/jonaswijne/research/polkadotapi_issue/node_modules/@polkadot/util/hex/index.js"
(vite:asset-import-meta-url) transform "/home/jonaswijne/research/polkadotapi_issue/node_modules/@polkadot/types-codec/packageInfo.js"

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@jacogr
Copy link
Member

jacogr commented Mar 7, 2022

So the error originates in this plugin asset-import-meta-url. See vitejs/vite#5558 for the upstream Vite tracking issue.

@polkadot-js-bot
Copy link

This issue has been open for 21 days with no activity and is not labelled as an enhancement. It will be closed in 7 days.

@Zedonboy
Copy link

@JonasWijne How did you solve your issue.

i am getting same issue

@polkadot-js-bot
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.

@polkadot-js polkadot-js locked as resolved and limited conversation to collaborators Apr 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
stale Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance.
Projects
None yet
Development

No branches or pull requests

4 participants