Microbundle: No name was provided for external module

Created on 4 Oct 2018  ยท  14Comments  ยท  Source: developit/microbundle

I always get following output in console.

What does it mean?
Need to fix it or just let it go?

No name was provided for external module 'http-errors' in output.globals โ€“ guessing 'createError'

Thanks.

question

Most helpful comment

That's what's already happening, hence my idea to hide the warning (in case we don't want to provide a way to override the default behavior)

All 14 comments

it only matters if you're running your bundle as a <script src> and using browser globals. Are you transpiling for node, or the browser?

bundle es module for both node and browser

To give a bit more clarity on the matter, this warning matters, as @developit explained, only if you are importing the bundle using the <script src> tag, because it will look for its dependencies in the global namespace.

This means that, inside your bundle, you will not have require('http-errors'), but window.createError (since that's the name Rollup guessed for you).

Ideally there should be a way to specify the names manually, maybe by command-line if we don't want to add a microbundle config file.

microbundle --external http-errors createError --external @emotion/core emotionCore

@FezVrasta

Thank you, it is very clear and helpful.

@developit if this isn't something you'd like to support I think those warnings should be disabled

or we just make it automatically?

since it has already got the right guess "createError".

That's what's already happening, hence my idea to hide the warning (in case we don't want to provide a way to override the default behavior)

Following-up on this warning. After upgrading to v0.12.0 I see this warning for each dependency. For instance,

No name was provided for external module 'prop-types' in output.globals โ€“ guessing 'propTypes'

This is related to the UMD build. Not sure what I am supposed to configure here to make the warning go away. Maybe this could be clarified in the README?

Since my package does not need a UMD modules, I work around this issue by specifying the module types I support with --format. This makes the warning go away.

I'm having the same warning, but I do want the UMD modules. So I can't simply fix it with --format

You can fix this by passing --globals prop-types=propTypes.

You can fix this by passing --globals prop-types=propTypes.

@developit But I have like 25 of them ๐Ÿ˜ฐ

No name was provided for external module '@fortawesome/fontawesome-svg-core' in output.globals โ€“ guessing 'fontawesomeSvgCore'
No name was provided for external module '@fortawesome/free-solid-svg-icons' in output.globals โ€“ guessing 'freeSolidSvgIcons'
No name was provided for external module 'react-grid-layout' in output.globals โ€“ guessing 'RGL'
No name was provided for external module 'styled-components' in output.globals โ€“ guessing 'styled'
No name was provided for external module 'react-markdown' in output.globals โ€“ guessing 'ReactMarkdown'
No name was provided for external module '@fortawesome/react-fontawesome' in output.globals โ€“ guessing 'reactFontawesome'
No name was provided for external module 'date-fns' in output.globals โ€“ guessing 'dateFns'
No name was provided for external module 'react-virtualized' in output.globals โ€“ guessing 'reactVirtualized'
No name was provided for external module '@material-ui/core/CircularProgress' in output.globals โ€“ guessing 'CircularProgress'
No name was provided for external module '@antv/data-set' in output.globals โ€“ guessing 'DataSet'
No name was provided for external module 'date-fns/format' in output.globals โ€“ guessing 'format'
No name was provided for external module 'date-fns/subDays' in output.globals โ€“ guessing 'subDays'
No name was provided for external module 'date-fns/differenceInHours' in output.globals โ€“ guessing 'differenceInHours'
No name was provided for external module '@material-ui/core/FormControlLabel' in output.globals โ€“ guessing 'FormControlLabel'
No name was provided for external module '@material-ui/core/Checkbox' in output.globals โ€“ guessing 'Checkbox'
No name was provided for external module '@material-ui/icons/RadioButtonChecked' in output.globals โ€“ guessing 'RadioButtonChecked'
No name was provided for external module '@material-ui/icons/RadioButtonUnchecked' in output.globals โ€“ guessing 'RadioButtonUnchecked'
No name was provided for external module '@material-ui/core/Table' in output.globals โ€“ guessing 'Table'
No name was provided for external module '@material-ui/core/TableBody' in output.globals โ€“ guessing 'TableBody'
No name was provided for external module '@material-ui/core/TableCell' in output.globals โ€“ guessing 'TableCell'
No name was provided for external module '@material-ui/core/TableHead' in output.globals โ€“ guessing 'TableHead'
No name was provided for external module '@material-ui/core/TableRow' in output.globals โ€“ guessing 'TableRow'
No name was provided for external module '@cubejs-client/react' in output.globals โ€“ guessing 'react'
No name was provided for external module 'colony-admin' in output.globals โ€“ guessing 'colonyAdmin'
No name was provided for external module 'react-pose' in output.globals โ€“ guessing 'posed'

That would be a crazy long command to set that for everything?

The main problem seems to be that e.g. @material-ui/core is installed, but to achieve minimal bundle size I import just the stuff I need from e.g. @material-ui/core/TableCell and it doesn't know that this actually does exist?

Hmm - material-ui isn't even available as UMD modules, so this isn't something Microbundle can fix in the first place.

If you're bundling an application (sounds like you are?) You should pass --external none to tell Microbundle to include all of these dependencies into your own bundle. Alternatively, if you move material-ui from dependencies to devDependencies in your package.json, it will be inlined.

Will close for now, leave a comment if this is still an issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JoviDeCroock picture JoviDeCroock  ยท  17Comments

pBread picture pBread  ยท  15Comments

wcastand picture wcastand  ยท  16Comments

Andarist picture Andarist  ยท  33Comments

gamtiq picture gamtiq  ยท  28Comments