Skip to content

USWDS - Add package exports for fonts and img src directories#4468

Merged
thisisdano merged 1 commit into
uswds:developfrom
pearl-truss:fix-webpack5-package-export-issues
Jan 19, 2022
Merged

USWDS - Add package exports for fonts and img src directories#4468
thisisdano merged 1 commit into
uswds:developfrom
pearl-truss:fix-webpack5-package-export-issues

Conversation

@pearl-truss

Copy link
Copy Markdown
Contributor

USWDS - Add package exports for fonts and img src directories

Description

After upgrading our project that uses USWDS to react-scripts v5.0.0 which uses Webpack 5. The following errors surfaced when trying to build our app

ModuleNotFoundError: Module not found: Error: Package path ./src/fonts/roboto-mono/roboto-mono-v5-latin-300.woff2 is not exported from package /Users/pearl/Projects/mymove/node_modules/uswds (see exports field in /Users/pearl/Projects/mymove/node_modules/uswds/package.json)

and

ModuleNotFoundError: Module not found: Error: Package path ./src/img/correct8.svg is not exported from package /Users/pearl/Projects/mymove/node_modules/uswds (see exports field in /Users/pearl/Projects/mymove/node_modules/uswds/package.json)

The changes in this PR resolves both issues

@thisisdano

Copy link
Copy Markdown
Contributor

Our next release will feature the following new exports:

"./src/js/components/*": "./src/js/components/*.js",
"./js/*": "./dist/js/*",
"./css/*": "./dist/css/*",
"./scss/*": "./dist/scss/*",
"./img/*": "./dist/img/*",
"./fonts/*": "./dist/fonts/*"

Would this work for your project?

@pearl-truss

pearl-truss commented Jan 19, 2022

Copy link
Copy Markdown
Contributor Author

Our next release will feature the following new exports:

"./src/js/components/*": "./src/js/components/*.js",
"./js/*": "./dist/js/*",
"./css/*": "./dist/css/*",
"./scss/*": "./dist/scss/*",
"./img/*": "./dist/img/*",
"./fonts/*": "./dist/fonts/*"

Would this work for your project?

Unfortunately no, I encountered the same errors with those exports

@thisisdano thisisdano merged commit 5847581 into uswds:develop Jan 19, 2022
@thisisdano thisisdano mentioned this pull request Jan 19, 2022
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.

2 participants