I notice in this example that it is referencing the umd build in the dist folder in the browser field of package.json:
{
"main": "dist/how-long-till-lunch.cjs.js",
"module": "dist/how-long-till-lunch.esm.js",
"browser": "dist/how-long-till-lunch.umd.js",
}
Thinking of interop with other tools, I wonder whether this is right?
I think Browserify and Webpack both use the browser field as having the meaning 'the entry point for this package, for browsers'. But they assume 'normal' cjs code.
For example have a look at the browser field in the package.json of debug:
{
"main": "./src/index.js",
"browser": "./src/browser.js",
"unpkg": "./dist/debug.js"
}
Notice how they use a file in the src folder here. Both Browserify and Webpack will pick up this file and package / bundle it, wrapping it with a umd wrapper for umd builds.
So I wonder, is it right that the file this project is setting for the browser field is a umd build, that already has a umd wrapper? Won't this file end up being wrapped twice?
I notice in this example that it is referencing the umd build in the dist folder in the
browserfield of package.json:{ "main": "dist/how-long-till-lunch.cjs.js", "module": "dist/how-long-till-lunch.esm.js", "browser": "dist/how-long-till-lunch.umd.js", }Thinking of interop with other tools, I wonder whether this is right?
I think Browserify and Webpack both use the
browserfield as having the meaning 'the entry point for this package, for browsers'. But they assume 'normal' cjs code.For example have a look at the
browserfield in the package.json of debug:{ "main": "./src/index.js", "browser": "./src/browser.js", "unpkg": "./dist/debug.js" }Notice how they use a file in the src folder here. Both Browserify and Webpack will pick up this file and package / bundle it, wrapping it with a umd wrapper for umd builds.
So I wonder, is it right that the file this project is setting for the
browserfield is a umd build, that already has a umd wrapper? Won't this file end up being wrapped twice?