Open ghost opened 11 years ago
Can you provide an example how it would work?
For example:
{
"name" : "browser-badge",
"version" : "1.1.0",
"description" : "generate browser version compatibility badges",
"main" : "index.js",
"bin" : {
"browser-badge": "bin/cmd.js"
},
"directories" : {
"example" : "example"
},
"dependencies" : {
"canvas" : "~0.13.1",
"optimist" : "~0.3.4",
"syntax-error" : "~0.0.0",
"through" : "~0.1.4"
},
"externalize": ["canvas", "optimist"],
"repository" : {
"type" : "git",
"url" : "git://github.com/substack/browser-badge.git"
},
"homepage" : "https://github.com/substack/browser-badge",
"keywords" : [
"browser",
"badge",
"png",
"compatibility",
"version"
],
"author" : {
"name" : "James Halliday",
"email" : "mail@substack.net",
"url" : "http://substack.net"
},
"license" : "MIT"
}
The canvas and optimist modules will be separated from main bundle.
I don't quite get it yet. Is this supposed to be the project package.json or a dependency package.json?
And even on both cases to which bundle would those modules (canvas, optimist) be externalized to?
Yes, this is the project package.json. Suppose we want to conditionally load the canvas and optimist. After the build process, there will be three bundles, canvas and optimist have their own bundles which have been externalized from project bundle.
Nice extension, if there's some package.json directive, it will be even more handy.