Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

Webpack compilation error when code splitting #15

Closed
kruczy opened this issue Sep 2, 2016 · 3 comments
Closed

Webpack compilation error when code splitting #15

kruczy opened this issue Sep 2, 2016 · 3 comments

Comments

@kruczy
Copy link

kruczy commented Sep 2, 2016

When using webpack code splitting the compiler will flag an error for missing webpackJsonp function:

asyncCommons.part.js:2 (JSC_UNDEFINED_VARIABLE)
variable webpackJsonp is undeclared
webpackJsonp([0],{

is there a way to tell the compiler that a global variable/function will be available on runtime?

Thanks

@Dominator008
Copy link

@kruczy What you need is an externs file for Webpack. I don't remember seeing one off the top of my head though.

@samthor
Copy link
Contributor

samthor commented Sep 2, 2016

What is webpackJsonp? You may be able to add an externs file that looks like this-

/** @externs */

/**
 * @param {!Array<number>} first
 * @param {!Object} second
 */
var webpackJsonp = function() {};

@samthor samthor closed this as completed Sep 2, 2016
@kruczy
Copy link
Author

kruczy commented Sep 3, 2016

webpackJsonp is a callback that is called from dynamically loaded chunks to declare all the modules so they can be imported

externs seems like the correct way to do this
Thanks alot

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants