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

add rollup plugin for building citation #3385

Open
wants to merge 17 commits into
base: update-config-dependencies
Choose a base branch
from

Conversation

cchang-vassar
Copy link
Collaborator

No description provided.

Copy link

changeset-bot bot commented Aug 27, 2024

⚠️ No Changeset found

Latest commit: a2e7918

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@@ -144,6 +150,7 @@ export const makeRollupConfig = (iifeName) =>
outputOptions: {
exports: "default",
globals: { jspsych: "jsPsychModule" },
plugins: [cffToJsonPlugin()],
Copy link
Member

Choose a reason for hiding this comment

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

I haven't looked into the details yet, but have you tried playing with the plugin order? Briefly looking at the plugin code, I think the custom plugin should be at the end of the plugin chain.

Copy link
Member

Choose a reason for hiding this comment

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

So this order works OK for the node.js builds when we don't have to bundle external dependencies. We thought it made sense to put it earlier because it's just doing a code injection and we thought having the stuff that comes after process that injection made sense.

Copy link
Member

Choose a reason for hiding this comment

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

Just confirmed that moving the custom plugin to the end doesn't fix the issue.

packages/config/rollup.js Outdated Show resolved Hide resolved
@bjoluc
Copy link
Member

bjoluc commented Sep 11, 2024

@jodeleeuw When you updated the dependencies, including esbuild from 0.15.14 to 0.23.1 in 59ce0b3, did you read the changelogs? There seem to be a lot of breaking changes in esbuild and we need to be confident that they are not breaking for @jspsych/config users (unless you are planning to release a config v4 for any other reason 🤔 ). I didn't get suspicious about this earlier because your commit message didn't make it clear to me that you were updating dependencies 🙈

"sucrase": "3.34.0",
"tslib": "2.6.2",
"typescript": "^5.2.2"
},
"overrides": {
Copy link
Member

Choose a reason for hiding this comment

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

When I last checked a few months ago, NPM did only respect overrides defined in the root package.json. Did that change in a recent NPM version? If so, we still can't rely on it until we require the new version...

Copy link
Member

@bjoluc bjoluc left a comment

Choose a reason for hiding this comment

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

esbuild has a define option to specify code replacements. I think we should be using that instead of a custom rollup plugin to keep it simple.

@bjoluc
Copy link
Member

bjoluc commented Sep 12, 2024

@jodeleeuw I double-checked and committed the rollup dependency updates in #3396 – they're all welcome and independent of the .json issue. Re that issue: Because we are using esbuild via the rollup plugin, the final bundling is performed by rollup. esbuild never sees @citation-js/core/package.json, hence can't run its JSON loader on it. Your workaround with the additional Rollup JSON loader is good for now, although the more desirable solution might be to inline the version string right in the citation-js build (like most other packages do too). I'm too busy to contribute there ATM though 😕

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.

3 participants