You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have met a special issue that typescript can not access webpack resolved alias variables, and I spent some time investigating. I have already solved it. The following is my procedures.
Step 1: Define webpack configuration file, my file name is webpack.config.dev.js
import config from 'config';
console.log(config.ENV)
You should define different environment webpack configuration file, such webpack.config.dev.js, webpack.config.prod.js etc, and then refer to src/config/dev.ts, src/config/prod.ts etc.
That's it. :)
The text was updated successfully, but these errors were encountered:
dongtong
changed the title
【Angular 2】How ts-loader import webpack resolved alias variables?
【Angular 2】How ts-loader imports webpack resolved alias's variables?
Nov 2, 2016
I have met a special issue that typescript can not access webpack resolved alias variables, and I spent some time investigating. I have already solved it. The following is my procedures.
Step 1: Define webpack configuration file, my file name is webpack.config.dev.js
Step 2: Define src/config/dev.ts. You could define global variables here.
Step 3: Typescript class import it and use it
You should define different environment webpack configuration file, such webpack.config.dev.js, webpack.config.prod.js etc, and then refer to src/config/dev.ts, src/config/prod.ts etc.
That's it. :)
The text was updated successfully, but these errors were encountered: