Skip to content

Conversation

@ambrons
Copy link
Contributor

@ambrons ambrons commented Mar 15, 2018

WIP: Without reordering the chunks the application produces the following error after production compile:

vendor.91c6138784dc3c8e7c09.js:1 Uncaught TypeError: Cannot read property 'call' of undefined
    at t (vendor.91c6138784dc3c8e7c09.js:1)
    at Object.9 (app.91c6138784dc3c8e7c09.js:1)
    at t (vendor.91c6138784dc3c8e7c09.js:1)
    at window.webpackJsonp (vendor.91c6138784dc3c8e7c09.js:1)
    at app.91c6138784dc3c8e7c09.js:1

That's with the order of the script injects done this way:
./dist/index.html

<script type="text/javascript" src="vendor.91c6138784dc3c8e7c09.js"></script>
<script type="text/javascript" src="app.91c6138784dc3c8e7c09.js"></script>
<script type="text/javascript" src="i18n/de.91c6138784dc3c8e7c09.js"></script>
<script type="text/javascript" src="i18n/pt.91c6138784dc3c8e7c09.js"></script>
<script type="text/javascript" src="i18n/ar.91c6138784dc3c8e7c09.js"></script>
<script type="text/javascript" src="i18n/zh.91c6138784dc3c8e7c09.js"></script>
<script type="text/javascript" src="i18n/en.91c6138784dc3c8e7c09.js"></script>
<script type="text/javascript" src="i18n/ru.91c6138784dc3c8e7c09.js"></script>
<script type="text/javascript" src="i18n/es.91c6138784dc3c8e7c09.js"></script>

However if you move app.*.js to the end all works as it should.

<script type="text/javascript" src="vendor.91c6138784dc3c8e7c09.js"></script>
<script type="text/javascript" src="i18n/de.91c6138784dc3c8e7c09.js"></script>
<script type="text/javascript" src="i18n/pt.91c6138784dc3c8e7c09.js"></script>
<script type="text/javascript" src="i18n/ar.91c6138784dc3c8e7c09.js"></script>
<script type="text/javascript" src="i18n/zh.91c6138784dc3c8e7c09.js"></script>
<script type="text/javascript" src="i18n/en.91c6138784dc3c8e7c09.js"></script>
<script type="text/javascript" src="i18n/ru.91c6138784dc3c8e7c09.js"></script>
<script type="text/javascript" src="i18n/es.91c6138784dc3c8e7c09.js"></script>
<script type="text/javascript" src="app.91c6138784dc3c8e7c09.js"></script>

screen shot 2018-03-15 at 12 50 02 pm

This was done in an effort to fix the same issue in my product after upgrading to webpack v3.x. Which has the same issue.

I looked at the back and forth in #794
And there's a few changes in there and a lot of overlap with what was done there.

@jsf-clabot
Copy link

jsf-clabot commented Mar 15, 2018

CLA assistant check
All committers have signed the CLA.

@ambrons
Copy link
Contributor Author

ambrons commented Mar 15, 2018

I failed to mention in my initial post that I'm speculating that the reason the i18n comes after the app is that the plugin isn't able to determine that app depends on i18n as they're optional depending on which one you select and only via the vendor package, which the app has a direct dependency on.

@ambrons
Copy link
Contributor Author

ambrons commented Mar 15, 2018

Reading over this it seems like a common problem and perhaps should just be baked into the plugin since it dictates that chunks must be used and what it's named already
jantimon/html-webpack-plugin#481

… suggestions to do.

This could probably be moved into the GlobalizeWebpackPlugin except that we don't know the total breathe of chunks or imports.  So it might be better here to provide a recipe instead.
@ambrons ambrons changed the title updated app-npm-webpack example to support version latest v3 of webpack updated app-npm-webpack example to support latest v3 version of webpack Mar 15, 2018
@rxaviers rxaviers closed this in 537e7d8 Apr 25, 2018
@rxaviers
Copy link
Member

Merged thanks

@rxaviers
Copy link
Member

I also did a few additional improvements 73d1d93

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants