Skip to content

Commit

Permalink
feat: Add APPSRC to the environment variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Nov 12, 2019
1 parent f00230d commit b2172d6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/config/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ function getClientEnvironment(publicUrl: string): ClientEnvironment {
// Useful for determining whether we’re running in production mode.
// Most importantly, it switches React into the correct mode.
NODE_ENV: process.env.NODE_ENV || 'development',
// The babel contains the entry directory.
APPSRC: process.env.APPSRC || paths.appSrc,
// Useful for resolving the correct path to static assets in `public`.
// For example, <img src={process.env.PUBLIC_URL + '/img/logo.png'} />.
// This should only be used as an escape hatch. Normally you would put
Expand Down
2 changes: 1 addition & 1 deletion src/plugs/babel-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = (conf: Configuration, options: OptionConf) => {
// The preset includes JSX, Flow, TypeScript, and some ESnext features.
{
test: /\.(js|mjs|jsx|ts|tsx)$/,
include: paths.appSrc as string,
include: options.dotenv.raw.APPSRC || paths.appSrc,
loader: require.resolve('babel-loader'),
options: {
presets: [
Expand Down
4 changes: 4 additions & 0 deletions src/type/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ export interface ClientEnvironment {
NODE_ENV?: 'development' | 'production' | string;
PUBLIC_URL?: string;
IMAGE_INLINE_SIZE_LIMIT?: string;
/**
* The babel contains the entry directory.
*/
APPSRC?: string;
},
stringified: {
'process.env': ClientEnvironment['raw'],
Expand Down

0 comments on commit b2172d6

Please sign in to comment.