Git Product home page Git Product logo

Comments (6)

amtb avatar amtb commented on July 28, 2024 8

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.

jhonycage avatar jhonycage commented on July 28, 2024 1

Thanks god I found this, really...

from ionic-environment-variables.

srjovanovic avatar srjovanovic commented on July 28, 2024

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.

srjovanovic avatar srjovanovic commented on July 28, 2024

from ionic-environment-variables.

gshigeto avatar gshigeto commented on July 28, 2024

I am going to close this as it seems to be resolved. Thanks!

from ionic-environment-variables.

GFoley83 avatar GFoley83 commented on July 28, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.