17 Matching Annotations
- May 2021
-
github.com github.com
-
Because of that, it's essential that the bundler doesn't treat the package as an external dependency. You can either modify the external option under server in rollup.config.js or the externals option in webpack.config.js,
-
- Nov 2020
-
-
Update: I was advised not to import directly from svelte on a reusable publishable store but instead declare svelte as an external.
-
In your case, it sounds like you just want to make svelte external when compiling your components and provide svelte's packages as es modules (straight from npm; look at the .mjs files).
Tags
Annotators
URL
-
-
github.com github.com
-
An Array which instructs the plugin to limit module resolution to those whose names match patterns in the array. Note: Modules not matching any patterns will be marked as external.
-
-
-
I think you might want to use resolve just for the umd build, and set svelte/internal as an external dependency for the es build, but I'm not entirely sure.
-
-
stackoverflow.com stackoverflow.com
- Oct 2020
-
rollupjs.org rollupjs.orgRollup2
-
If you return an object, then it is possible to resolve an import to a different id while excluding it from the bundle at the same time. This allows you to replace dependencies with external dependencies without the need for the user to mark them as "external" manually via the external option
-
If you do want to include the module in your bundle, you need to tell Rollup how to find it. In most cases, this is a question of using @rollup/plugin-node-resolve.
-
-
github.com github.com
- Sep 2020
-
rollupjs.org rollupjs.orgRollup3
-
/node_modules/
This might be better than explicitly listing all external modules...?
-
or an Array of module IDs, or regular expressions to match module IDs, that should remain external to the bundle.
-
Resolve imports to module ids (i.e. file names) using the same plugins that Rollup uses, and determine if an import should be external. If null is returned, the import could not be resolved by Rollup or any plugin but was not explicitly marked as external by the use
-
-
engineering.mixmax.com engineering.mixmax.com
-
But this is only a halfway decent way to clarify that this is an external dependency, because the only way to resolve a peer dependency warning is to install react from npm—there's no way to notify npm that you resolve the dependency to a browser global. So peer dependencies should be avoided in favor of external declarations. Then Rollup will take care of warning about "unresolved dependencies", even if external declarations can't express a particular version range with which your library is compatible like peer dependencies can.
Interesting. Didn't realize. From my perspective, I usually do install packages via npm, so wouldn't have known about this problem.
npm and rollup both try to solve this problem but in different ways that apparently conflict? So if a lib author lists peerDependencies then it can cause problems for those getting lib via browser (CDN)? How come so many libs use it then? How come I've never heard of this problem before?
-
Now, in the resulting bundle, you'll see that import React from 'react'; remains. This lets the application that consumes this library decide how it would like to resolve this dependency. This will generally be to a browser global, using the the external and globals options, as above; but could be to a local file or even to npm for some reason.
-
external: ['react']
-
When you publish this module, you do not want to bundle React, for the reasons described above. (It would be even worse to bundle React in a library, because then its copy would duplicate that loaded by the application!) But the fix is slightly different for a library than an application. In this library's Rollup configuration, we only want to specify external, not globals:
-