Closed MattSPalmer closed 9 years ago
Really thanks for this. I noticed, that problem is not path itself, but fact that path is relative. When we are in popup url like chrome-extension:98S7AD98AS7D98AS/popup
and load script something/main.js
it looks for /popup/something/main.js
I fixed it by changing script path to absolute in https://github.com/schovi/webpack-chrome-extension/commit/9ffe78cf13028b5d88e8442e3e8e1995856c6f62
Currently,
webpackScriptURL
is a direct copy of the index.html URL. This causes an error when building for production, as shown below:webpackScriptURL
ofpopup/index.js
<script src="popup/index.js" async defer></script>
popup/index.html
isindex.js
, notpopup/index.js
(we don't have two nested popup directories)This change addresses the issue by calling
Remove.path
onwebpackScriptURL
whenNODE_ENV
is 'production', giving us the correct relative URL toindex.js
.