Comments (6)
Hi,
You need to tell webpack where to find (resolve) the app/env
files...
I guess you have a webpack.test.js
somewhere, if so, update the resolve
block to look like this.
resolve: {
alias: {
'@app/env': path.resolve(environmentPath('dev'))
},
extensions: ['.ts', '.js']
},
...
Define your environmentPath
function to return the path to your env config as in the README of the project. You can even extract it into a env-helper.js
file outside of the webpack configs to avoid code duplication, and require your helper.
Hope it helps ;)
from ionic-environment-variables.
Thanks god I found this, really...
from ionic-environment-variables.
When I try to start karma unit testing, console shows errors:
Module not found: Error: Can't resolve '@ app/env' in...
P.S. Compiling and building works as it should (ionic serve, ionic build cordova, ionic cordova compile, ...).
from ionic-environment-variables.
from ionic-environment-variables.
I am going to close this as it seems to be resolved. Thanks!
from ionic-environment-variables.
@gshigeto This info should probably be added to the README as it's likely the majority of people will be using unit tests and this needs to be inplace in order to make them work.
from ionic-environment-variables.
Related Issues (20)
- The Angular AoT build failed. typescript error HOT 8
- Cannot find module '@app/env'. HOT 7
- Can not find '@app/env' when running 'ionic cordova build ios' HOT 8
- TypeError: Cannot read property 'resolve' of undefined HOT 4
- Environment folder outside Angular
- Custom environment other than IONIC_ENV, is not recognized as an internal or external command HOT 2
- How to ionic serve --prod? HOT 2
- using environment variables with live deploy HOT 1
- When I build with params MY_ENV=dev and --prod, ionic builds with the prod environment. HOT 3
- Everytime its load the last environment file
- Not working HOT 3
- Cannot find module ''@app/env" only at first run
- Loading environment variables when no `environment.XXX.ts` present
- Error: Cannot find module "@app/env" HOT 4
- Production env doesn't work with run livereload
- Updating env file with new attribute is not picked up by build or serve HOT 1
- No example in how to write the enviroment variable itself HOT 1
- Error: The Angular AoT build failed
- Building Ionic for Browser --
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ionic-environment-variables.