Repository: internetarchive/openlibrary

Issue:
Intermittent build bug in node_modules/@vue ... entry-wc.js
<!-- What problem are we solving? What does the experience look like today? What are the symptoms? -->

### Evidence / Screenshot (if possible)

Run `docker build -t openlibrary/olbase:latest -f docker/Dockerfile.olbase .` on an M1 Mac generates the errors below.  _Rerunning the same command succeeds._  This happened on ol-home0 [deploy-2021-03-04](https://github.com/internetarchive/openlibrary/releases) and also on my local M1 Mac afterwards.

___You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders___

### Relevant url?
<!-- `https://openlibrary.org/...` -->

### Steps to Reproduce
<!-- What steps caused you to find the bug? -->
1. Go to ...
2. Do ...

<!-- What actually happened after these steps? What did you expect to happen? -->
* Expected: A successful build
* Actual:
```
#32 18.56 parallel --verbose -q \
#32 18.56 	npx vue-cli-service build --no-clean --mode {2} --dest static/build/components/{2} --target wc --name "ol-{1/.}" "{1}" \
#32 18.56 ::: openlibrary/components/HelloWorld.vue openlibrary/components/LibraryExplorer.vue ::: production development
#32 18.64 npx vue-cli-service build --no-clean --mode production --dest static/build/components/production --target wc --name ol-HelloWorld openlibrary/components/HelloWorld.vue
#32 18.65 npx vue-cli-service build --no-clean --mode development --dest static/build/components/development --target wc --name ol-HelloWorld openlibrary/components/HelloWorld.vue
#32 18.65 npx vue-cli-service build --no-clean --mode production --dest static/build/components/production --target wc --name ol-LibraryExplorer openlibrary/components/LibraryExplorer.vue
#32 18.65 npx vue-cli-service build --no-clean --mode development --dest static/build/components/development --target wc --name ol-LibraryExplorer openlibrary/components/LibraryExplorer.vue
#32 21.04
#32 21.04  ERROR  Failed to compile with 1 error10:25:36 AM
#32 21.04
#32 21.04  error  in ./node_modules/@vue/cli-service/lib/commands/build/entry-wc.js
#32 21.04
#32 21.04 Module parse failed: Unexpected token (11:72)
#32 21.04 You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
#32 21.04 |
#32 21.04 | import olHelloWorld from '~root/openlibrary/components/HelloWorld.vue?shadow'
#32 21.04 > window.customElements.define('ol-hello-world', wrap(Vue, olHelloWorld)) olLibraryExplorer))
#32 21.04
#32 21.04  ERROR  Failed to compile with 1 error10:25:36 AM
#32 21.04
#32 21.04  error  in ./node_modules/@vue/cli-service/lib/commands/build/entry-wc.js
#32 21.04
#32 21.04 Module parse failed: Unexpected token (11:72)
#32 21.04 You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
#32 21.04 |
#32 21.04 | import olHelloWorld from '~root/openlibrary/components/HelloWorld.vue?shadow'
#32 21.04 > window.customElements.define('ol-hello-world', wrap(Vue, olHelloWorld)) olLibraryExplorer))
#32 21.04
#32 21.04 -  Building for development as web component...
#32 21.04  ERROR  Build failed with errors.
#32 21.09
#32 21.09  ERROR  Failed to compile with 1 error10:25:36 AM
#32 21.09
#32 21.09  error  in ./node_modules/@vue/cli-service/lib/commands/build/entry-wc.js
#32 21.09
#32 21.09 Module parse failed: Unexpected token (11:72)
#32 21.09 You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
#32 21.09 |
#32 21.09 | import olHelloWorld from '~root/openlibrary/components/HelloWorld.vue?shadow'
#32 21.09 > window.customElements.define('ol-hello-world', wrap(Vue, olHelloWorld)) olLibraryExplorer))
#32 21.09
#32 21.09  ERROR  Failed to compile with 1 error10:25:36 AM
#32 21.09
#32 21.09  error  in ./node_modules/@vue/cli-service/lib/commands/build/entry-wc.js
#32 21.09
#32 21.09 Module parse failed: Unexpected token (11:72)
#32 21.09 You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
#32 21.09 |
#32 21.09 | import olHelloWorld from '~root/openlibrary/components/HelloWorld.vue?shadow'
#32 21.09 > window.customElements.define('ol-hello-world', wrap(Vue, olHelloWorld)) olLibraryExplorer))
#32 21.09
#32 21.09 -  Building for development as web component...
#32 21.09  ERROR  Build failed with errors.
#32 21.12
#32 21.12  ERROR  Failed to compile with 1 error10:25:36 AM
#32 21.12
#32 21.12  error  in ./node_modules/@vue/cli-service/lib/commands/build/entry-wc.js
#32 21.12
#32 21.12 Module parse failed: Unexpected token (11:72)
#32 21.12 You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
#32 21.12 |
#32 21.12 | import olHelloWorld from '~root/openlibrary/components/HelloWorld.vue?shadow'
#32 21.12 > window.customElements.define('ol-hello-world', wrap(Vue, olHelloWorld)) olLibraryExplorer))
#32 21.12
#32 21.12  ERROR  Failed to compile with 1 error10:25:36 AM
#32 21.12
#32 21.12  error  in ./node_modules/@vue/cli-service/lib/commands/build/entry-wc.js
#32 21.12
#32 21.12 Module parse failed: Unexpected token (11:72)
#32 21.12 You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
#32 21.12 |
#32 21.12 | import olHelloWorld from '~root/openlibrary/components/HelloWorld.vue?shadow'
#32 21.12 > window.customElements.define('ol-hello-world', wrap(Vue, olHelloWorld)) olLibraryExplorer))
#32 21.12
#32 21.12 -  Building for production as web component...
#32 21.12  ERROR  Build failed with errors.
#32 21.14
#32 21.14  ERROR  Failed to compile with 1 error10:25:37 AM
#32 21.14
#32 21.14  error  in ./node_modules/@vue/cli-service/lib/commands/build/entry-wc.js
#32 21.14
#32 21.14 Module parse failed: Unexpected token (11:72)
#32 21.14 You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
#32 21.14 |
#32 21.14 | import olHelloWorld from '~root/openlibrary/components/HelloWorld.vue?shadow'
#32 21.14 > window.customElements.define('ol-hello-world', wrap(Vue, olHelloWorld)) olLibraryExplorer))
#32 21.14
#32 21.14  ERROR  Failed to compile with 1 error10:25:37 AM
#32 21.14
#32 21.14  error  in ./node_modules/@vue/cli-service/lib/commands/build/entry-wc.js
#32 21.14
#32 21.14 Module parse failed: Unexpected token (11:72)
#32 21.14 You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
#32 21.14 |
#32 21.14 | import olHelloWorld from '~root/openlibrary/components/HelloWorld.vue?shadow'
#32 21.14 > window.customElements.define('ol-hello-world', wrap(Vue, olHelloWorld)) olLibraryExplorer))
#32 21.14
#32 21.15 -  Building for production as web component...
#32 21.15  ERROR  Build failed with errors.
#32 21.15 Makefile:34: recipe for target 'components' failed
#32 21.15 make: *** [components] Error 4
------
executor failed running [/bin/sh -c make]: exit code: 2
```
### Details

- **Logged in (Y/N)?** 
- **Browser type/version?** 
- **Operating system?** 
- **Environment (prod/dev/local)?** prod
<!-- If not sure, put prod -->

### Proposal & Constraints
<!-- What is the proposed solution / implementation? Is there a precedent of this approach succeeding elsewhere? -->

### Related files
<!-- Files related to this issue; this is super useful for new contributors who might want to help! If you're not sure, leave this blank; a maintainer will add them. -->

### Stakeholders
<!-- @ tag stakeholders of this bug -->



Discussion:
Ahhhh, I think I know what's happening! Looks like this build flow can't run `--mode {} ::: development production` in parallel! It tries to edit the same file. I'm just going to remove the `development` mode entirely; haven't found it that useful anyways.

Resolving patch:
diff --git a/openlibrary/plugins/upstream/utils.py b/openlibrary/plugins/upstream/utils.py
--- a/openlibrary/plugins/upstream/utils.py
+++ b/openlibrary/plugins/upstream/utils.py
@@ -146,8 +146,6 @@ def render_component(name, attrs=None, json_encode=True):
 
     if name not in included:
         url = static_url('build/components/production/ol-%s.min.js' % name)
-        if query_param('debug'):
-            url = static_url('build/components/development/ol-%s.js' % name)
         html += '<script src="%s"></script>' % url
         included.append(name)
 


Test patch: