Fetch the versions mentioned in package.json.
tyagirajat200 opened this issue ยท 4 comments
If I provide the complete package.json with dependencies, the code bundling process should fetch the versions mentioned in package.json instead of always fetching the latest version. Please guide me on the possible ways to achieve this.
Link -> Click here
Yeah, sorry that's a bug ๐ ๐
, I'll try to get this fixed. In the meantime you can overcome this issue by manually setting the version for the module
E.g.
// Click Build for the Bundled, Minified & Compressed package size
export * from "react@17.0.2";
export * from "react-dom@17.0.2";
class App extends Component {
constructor() {
super();
this.state = {
name: 'React',
};
}
render() {
return 'Raj';
}
}
Hi @okikio ,
Thank you for your prompt reply. Kindly inform us once the issue has been resolved.
Hi @okikio ,
Can the required code be included solely? For instance:
import { zip } from 'https://unpkg.com/lodash-es@4.17.15/lodash.js';
console.log(zip([1, 2], ['a', 'b']));
In this scenario, the bundler should fetch and incorporate only the zip
method from lodash, rather than including all of its methods, which is the current behavior.
It's because you're fetching from the URL, it's much harder to determine what to treeshake when a package is being fetched from a URL directly
Here is the fix,
// Click Build for the Bundled, Minified & Compressed package size
import { zip } from "lodash-es@4.17.15";
console.log(zip([1, 2], ['a', 'b']))