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

best way to not externalize assets? #15

Closed
wmertens opened this issue Oct 4, 2016 · 3 comments
Closed

best way to not externalize assets? #15

wmertens opened this issue Oct 4, 2016 · 3 comments
Labels

Comments

@wmertens
Copy link

wmertens commented Oct 4, 2016

Sometimes you will be loading e.g. css files from an npm package, and those need to be converted so they cannot be external. This is what I came up with:

            nodeExternals({
                // load non-javascript files with extensions, presumably via loaders
                whitelist: [/\.(?!(js|json)$).{1,5}$/i],
            }),

That assumes that anything that has a max-5-char extension but is not js or json, will need to be parsed as an internal module.

Is this the best way? If so, perhaps put it in the Readme?

@liady liady added the question label Oct 4, 2016
@liady
Copy link
Owner

liady commented Oct 4, 2016

@wmertens Good idea. I added it to the Q&A section. Thanks!

@liady liady closed this as completed Oct 4, 2016
@richardscarrott
Copy link

Hi @wmertens, good tip; out of interest, why do you avoid whitelisting files with an extension longer than 5 chars?

@wmertens
Copy link
Author

Can't remember why I did that, and can't think of a reason ;)
Perhaps just replace it with [^.]*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants