scaife-viewer / readhomer

in-progress flagship demo project for the Scaife Viewer ecosystem
3 stars 2 forks source link

loading globalComponents fails in production #32

Closed rillian closed 5 years ago

rillian commented 5 years ago

I was trying to use the netlify builds, but the output of yarn build won't actually load. It fails with

TypeError: t.__file is undefined main.js:13:2
56d7 main.js:13
forEach self-hosted:266
56d7 main.js:11
Webpack 6

The issue seems to be related to globalComponents array containing objects without a __file property in the minified version.

rillian commented 5 years ago

The __file property is debug only, which is why the loader fails in production builds.

The vue.js guide suggests using require.context instead for this kind of loading, which has the advantage of not needing to maintain an index.js file.