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

Update documentation to support bundlers with Yarn / other non node_modules based resolvers #5

Open
william-shere opened this issue Dec 30, 2024 · 1 comment · May be fixed by #6
Open
Labels
bug Something isn't working

Comments

@william-shere
Copy link

william-shere commented Dec 30, 2024

Describe the bug

The example Webpack / Rollup config linked to in the bundling section of the installation page will only work for an NPM based project, not Yarn or any other PnP / monorepo setup.

The Webpack config can be made to work with any setup that correctly modifies the resolver by changing the line

from: path.resolve(__dirname, 'node_modules/@shoelace-style/shoelace/dist/assets'),

to

from: path.join(path.dirname(require.resolve(`@shoelace-style/shoelace/dist/shoelace.js`)), "assets"),

(see this note in the CopyWebpackPlugin docs) This relies on the "showlace.js" file exported in Showlace's package.json being in the same directory as the "assets" folder which seems a bit messy but I could not find a better way since you cannot "resolve" a folder in CommonJS.

I have never used Rollup so I am not sure what the best way to achieve the same in Rollup would be. Perhaps someone more familiar can advise.

Alternatively we could add a mention in the Shoelace documentation or as a comment in the config files that this is something to consider when not installing with NPM.

Happy to do a PR on the Webpack example repo with this change if that is the agreed solution.

@william-shere william-shere added the bug Something isn't working label Dec 30, 2024
@claviska
Copy link
Member

claviska commented Jan 2, 2025

Thanks for this. The proposed solution seems fine to me.

@claviska claviska transferred this issue from shoelace-style/shoelace Jan 2, 2025
@william-shere william-shere linked a pull request Jan 9, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants