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

Build with vitejs #1417

Closed
wants to merge 78 commits into from
Closed

Build with vitejs #1417

wants to merge 78 commits into from

Conversation

peterpeterparker
Copy link
Member

@peterpeterparker peterpeterparker commented Apr 12, 2023

Changes

  • drop webpack for vite
    • remove webpack dependencies
    • add various vite dependencies
    • add configuration vite.config.ts
    • convert webpack plugins - e.g. for canister IDs or to remove script or prerendering - to vite.plugin.ts
    • move and adapt html file for index.html
    • move showcase html and ts file to separate directory
  • set buffer, process and stream-browserify as dependencies instead of dev dependencies because these are such
  • polyfill buffer manually in index.ts
  • set script to be loaded as module by canister

Remaining non-production blocker tasks in #1458.

package.json Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there seems to be an issue here, images are gone

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks having a look

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this for vite? why did all the showcase files have to move btw?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this for vite?

this what?

why did all the showcase files have to move btw?

vite needs one single entry, an index.html. did not really found how to have index.html and showcase.html and having it separate is cleaner anyway.

src/showcase/src/showcase.ts Outdated Show resolved Hide resolved
vite.config.ts Show resolved Hide resolved
vite.plugins.ts Outdated Show resolved Hide resolved
HACKING.md Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you know why all list items changed from * to -?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prettier format

@frederikrothenberger
Copy link
Member

Maybe this is a stupid question, but doesn't vite imply rollup? And isn't rollup causing all the reproducibility issues that the NNS dapp is having?
Won't this be an issue for II too?

@peterpeterparker
Copy link
Member Author

Maybe this is a stupid question, but doesn't vite imply rollup? And isn't rollup causing all the reproducibility issues that the NNS dapp is having?

That's a good point, we have to test. In NNS-dapp the recent reproducibility issues had to do with packaging CSS, which has been solved in Rollup and is probably not a problem for II because the CSS is not chunked, and some recursive import on library packaged within the ledgerhq hardware wallet which we do not have neither here.

But yeah few tests is a good idea.

@peterpeterparker
Copy link
Member Author

First reproducibility issue did not work so I'm trying now the option discussed in rollup/plugins#1425 (comment)

@peterpeterparker
Copy link
Member Author

Reproducibility issue solved and tested @frederikrothenberger.

There was one issue discovered by @nmattia (💪). Rollup does not generate process.env code the same way if the value is defined or undefined. That lead to inconsistency at comparing the sha in the CI. Providing default value solves it - i.e. having process.env.... used in code always defined solves it.

@peterpeterparker
Copy link
Member Author

Let's have a clean start. I created a patch from this PR and started a new clean one 👉 #1461

@peterpeterparker peterpeterparker deleted the build/vitejs-again branch April 25, 2023 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants