Skip to content

Build: Source external deps from package.json - #1590

Merged
adamziel merged 4 commits into
trunkfrom
source-external-deps-from-package-json
Jul 9, 2024
Merged

Build: Source external deps from package.json#1590
adamziel merged 4 commits into
trunkfrom
source-external-deps-from-package-json

Conversation

@adamziel

@adamziel adamziel commented Jul 9, 2024

Copy link
Copy Markdown
Collaborator

Follows up on
#1589 and #1586

Treating package IDs matching node_modules as external works, but causes Rollup to substitute the module name with the absolute module path on the host machine, e.g. import "ini" becomes import "/home/runner/work/wordpress-playground/wordpress-playground/node_modules/ini/lib/ini.js" which is not what we want.

This PR sources the external packages names from the package.json file to both treat all these imports as external AND preserve their original import identifier. It also adds the required package.json building steps to the @php-wasm/universal package and makes the @php-wasm/stream-compression package public to ensure the published packages will reference the correct dependencies.

Testing instructions

Run nx build php-wasm-node and confirm the resultingdist/packages/php-wasm/index.js file and other built npm-published modules do import external modules using their name, not their absolute path.

Follows up on
#1589 and #1586

Treating package IDs matching `node_modules` as external works, but
causes Rollup to substitute the module name with the absolute module
path on the host machine, e.g. `import "ini"` becomes `import
"/home/runner/work/wordpress-playground/wordpress-playground/node_modules/ini/lib/ini.js"`
which is not what we want.

This PR sources the external packages names from the package.json file
to both treat all these imports as external AND preserve their original
import identifier.

 ## Testing instructions

Run nx build php-wasm-node and confirm the resultingdist/packages/php-wasm/index.js file and other built npm-published modules do
import external modules using their name, not their absolute path.
@adamziel adamziel added [Type] Bug An existing feature does not function as intended [Type] Repo / Project Management labels Jul 9, 2024
@adamziel
adamziel merged commit 91ce43c into trunk Jul 9, 2024
@adamziel
adamziel deleted the source-external-deps-from-package-json branch July 9, 2024 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Bug An existing feature does not function as intended [Type] Repo / Project Management

1 participant