Need help running webpack items based on environment with AppFlow support

I have Sentry webpack plugin as part of my build process. Right now it’s running in my dev environment when I run npm run serve which is bad because it’s uploading sourcemaps to Sentry. I want that only to occur when in production which would be (a) Firebase for the web version of my app, and (b) AppFlow for the mobile version of my app.

I don’t know how to do this because I don’t think I have the plan for environment variables in AppFlow. Is there anyway to make it work for that simple reason? I would also like to remove the source map files as Sentry is the only one that needs them I think? Help!

Is mac OS - 2021.10 giving problems to anyone else? When I try to build my Ionic/Vue project I get this result:

[01:55:07]: -------------------------
[01:55:07]: --- Step: upload_logs ---
[01:55:07]: -------------------------
|              Lane Context               |
| DEFAULT_PLATFORM | ios                  |
| PLATFORM_NAME    | android              |
| LANE_NAME        | android deploy_build |
| PROJECT_WEB_DIR  | dist                 |
[01:55:11]: Exit status of command 'npm run build' was 1 instead of 0.

> jetfoiler@1.13.12 build
> vue-cli-service build


-  Building for production...
 ERROR  Error: Cannot find module 'vue-loader-v16/package.json'
Require stack:
- /builds/kaiconcepts/jetfoil-mobile-app/node_modules/@vue/cli-service/lib/config/base.js
- /builds/kaiconcepts/jetfoil-mobile-app/node_modules/@vue/cli-service/lib/Service.js
- /builds/kaiconcepts/jetfoil-mobile-app/node_modules/@vue/cli-service/bin/vue-cli-service.js
Error: Cannot find module 'vue-loader-v16/package.json'

This started happening yesterday when 2021.10 became the active environment. When I switch back to 2021.09 everything works fine.

1 Like

Yes, this is happening to me as well. Thanks for posting this, this fixed my issue!

Oops! Didn’t mean to ask a question under another post of mine! But glad this helped! Going to re-post correctly!

The answer is the add the following to your package.json under dev dependancies and then run npm install:

"vue-loader-v16": "npm:vue-loader@^16.1.0",
"fork-ts-checker-webpack-plugin-v5": "npm:fork-ts-checker-webpack-plugin@^5.0.11"

Not sure how to add them via command line as I’ve never seen the “npm:” prefix before on the version side of things. But this got me going again! @ldebeasi Feel free to correct me on how to do this from command line. npm i --save-dev vue-loader-v16 did not give me npm:vue-loader@^16.1.0 on the value side.

1 Like

This is the correct workaround for now. It won’t be needed in Ionic 6 as we are using Vue CLI v5 which does not make use of those dependencies (or at least makes them required, not optional).

I believe the npm: prefix lets you provide aliases for packages, but I am not 100% certain.

1 Like