Skip to content

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

@william-shere

Description

@william-shere

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions