-
Notifications
You must be signed in to change notification settings - Fork 507
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
Rollup warnings during UMD builds: "but could not be resolved -- treating it as an external dependency" and "No name was provided for external module" #989
Comments
UMD context missingSo you removed the bottom half of the issue template -- please don't do that, it is there for a reason. Since you didn't fill it out, it's difficult to tell the context here, such as why you're building UMD specifically, how you plan on using UMD, and if you know what UMD entails. UMD is not part of TSDX's defaults and is not very popular in and out of TSDX (at least not in today's day and age of package managers). I'll try answering without that, but issue templates are important to fill out and giving context and intent is important when creating an issue. How UMD in Rollup worksThese are warnings from Rollup (and some core plugins) specifically for the UMD build. It seems like you may not be familiar with what UMD entails, so I'll summarize a bit below. TSDX by default treats all absolute imports as Fixing globals warningsThat guess probably looks correct in your case, so you could ignore the warning, or to remove the warning, you could explocitly specify Rollup's If you'd prefer to bundle your deps in UMD, you can do so by following the directions in #179 (comment) . Fixing "could not be resolved" warningsRegarding the "could not be resolved" error, I can't seem to find what I thought was a But that might be occurring correctly actually -- did you |
UMD contextI want to bundle deps in UMD to check the final size Flowproject A
change src/index.ts import dayjs from 'dayjs'
import axios from 'axios'
const sum = (a: number, b: number) => {
console.log('boop');
return a + b;
};
const minus = (a: number, b: number) => {
console.log('poop');
return a - b;
};
export {
sum,
minus,
dayjs,
axios,
}
project B
change src/index.ts import { minus } from 'A'
function final(a: number, b: number) {
return minus(a, b)
}
export {
final
} change tsdx.config.js module.exports = {
rollup(config) {
if (config.output.format === 'umd') {
delete config.external;
}
return config;
}
} check umd.development.js and umd.production.min.js. |
This was never answered.
All TSDX templates come with
This was a tree-shaking question (I did not catch that on my initial read of this), and it was responded to separately in #992 which duplicated most of this comment. |
Current Behavior
I create a project webttttt by using
tsdx create webttttt
(select basic).and create on simple function and build and publish in npm.
then I create another project by using
tsdx create
(select basic).I import a function from webttttt and build package by using
tsdx build --format cjs,esm,umd
then
The text was updated successfully, but these errors were encountered: