-
Notifications
You must be signed in to change notification settings - Fork 304
Config file from webpack not found #1359
Comments
+1 got the same issue... |
+1 same here cli packages: (/usr/local/lib/node_modules)
global packages:
local packages:
System:
Environment Variables:
Misc:
|
Same also here. Same issue |
Same issue after upgrade v3.8.0 to v.3.9.2 |
got the same cli packages: (/usr/local/lib/node_modules)
global packages:
local packages:
System:
Environment Variables:
Misc:
|
This removes following warning: Remove warning: Without `from` option PostCSS could generate wrong source map or do not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning `from: the input file name (most runners set it automatically).` Source: https://github.com/postcss/postcss Fixes ionic-team#1359 #13763 ionic-team#1359 ionic-team/ionic-framework#13763
@polfdz the error above with the postcss has nothing to do with your problem. Those, which have the same problem, maybe this can help you: Do you have a custom webpack config? Because, if you use a custom webpack config, you need to provide everything the ionic app scripts webpack config file did provide, too. To do so, you could generate a common webpack config file, where you extend the ionic app scripts one. Then you could extend a development or production webpack config from the common one you created. Here is an example how this could be done: package.json {
"scripts": {
...
"build:production": "npm run prepareApplication && cross-env ENVIROMENT=production CURRENT_BUILD=production ionic-app-scripts build --webpack ./config/production/webpack.js --sass ./config/production/sass.js --copy ./config/production/copy.js",
"prepareApplication": "npm run compileConfigFiles",
"compileConfigFiles": "tsc --project tsconfig.prepare.json"
...
}
} Ionic App Scripts accepts only a webpack config as a javascript file. There we tell the typescript compiler to use our custom tsconfig.prepare.json {
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"alwaysStrict": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"lib": [
"es2015",
"dom"
],
"typeRoots": [
"./node_modules/@types"
],
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": false,
"target": "es5"
},
// this tells to only include the files in the config folder
"include": [
"config/**/*.ts"
],
"exclude": [
"node_modules"
],
"compileOnSave": false,
"atom": {
"rewriteTsconfig": false
}
} production/webpack.ts import { BuildConfiguration } from '../builds.configuration';
import * as webpack from 'webpack';
import * as merge from 'webpack-merge';
import { commonWebpackConfig } from '../common/webpack';
module.exports = {
prod: merge(commonWebpackConfig.prod, {
plugins: [
new webpack.EnvironmentPlugin({
CURRENT_BUILD: BuildConfiguration.BUILD.Production
})
]
}),
dev: merge(commonWebpackConfig.dev, {
plugins: [
new webpack.EnvironmentPlugin({
CURRENT_BUILD: BuildConfiguration.BUILD.Production
})
]
})
}; builds.configuration.ts export type CurrentBuildType = 'development' | 'staging' | 'production';
interface ICurrentBuildTypes {
Development: CurrentBuildType;
Staging: CurrentBuildType;
Production: CurrentBuildType;
}
class CurrentBuildTypes implements ICurrentBuildTypes {
public readonly Development = 'development';
public readonly Staging = 'staging';
public readonly Production = 'production';
}
export class BuildConfiguration {
public static readonly BUILD = new CurrentBuildTypes();
} common/webpack.ts import webpack = require('webpack');
import * as merge from 'webpack-merge';
const defaultConfig = require('@ionic/app-scripts/config/webpack.config');
const commonPlugins: webpack.Plugin[] = [];
const commonConfig = {
plugins: commonPlugins
};
export const commonWebpackConfig = {
dev: merge(defaultConfig.dev, commonConfig),
prod: merge(defaultConfig.prod, commonConfig)
}; So now we could access the environment variables in our code base. config folder
config.common.ts import { IConfig } from './config';
export const PARTIAL_CONFIG_COMMON: Partial<IConfig> = {
port: 8000,
RESOURCE_API_PATH: "",
AVAILABLE_CULTURES: ['de-DE'],
FALLBACK_CULTURE: 'de-DE'
}; config.dev.ts import { IConfig } from './config';
export const PARTIAL_CONFIG_DEV: Partial<IConfig> = {
API_BASE_PATH: "http://dev.api.example.com"
}; config.prod.ts import { IConfig } from './config';
export const PARTIAL_CONFIG_PROD: Partial<IConfig> = {
API_BASE_PATH: "http://api.example.com"
}; config.ts import { PARTIAL_CONFIG_COMMON } from './config.common';
import { PARTIAL_CONFIG_DEV } from './config.dev';
import { PARTIAL_CONFIG_STAGING } from './config.staging';
import { PARTIAL_CONFIG_PROD } from './config.prod';
import { BuildConfiguration } from '../../config/builds.configuration';
export interface IConfig {
port: number;
API_BASE_PATH: string;
RESOURCE_API_PATH: string;
AVAILABLE_CULTURES: string[];
FALLBACK_CULTURE: string;
}
export function IsDevelopmentEnviroment() {
return process.env.CURRENT_BUILD === BuildConfiguration.BUILD.Development;
}
export function IsStagingEnviroment() {
return process.env.CURRENT_BUILD === BuildConfiguration.BUILD.Staging;
}
export function IsProductionEnviroment() {
return process.env.CURRENT_BUILD === BuildConfiguration.BUILD.Production;
}
let _config: Partial<IConfig> = Object.assign({}, PARTIAL_CONFIG_COMMON);
switch (true) {
case IsDevelopmentEnviroment():
_config = Object.assign(_config, PARTIAL_CONFIG_DEV);
break;
case IsCMSEnviroment():
_config = Object.assign(_config, PARTIAL_CONFIG_CMS);
break;
case IsStagingEnviroment():
_config = Object.assign(_config, PARTIAL_CONFIG_STAGING);
break;
case IsProductionEnviroment():
_config = Object.assign(_config, PARTIAL_CONFIG_PROD);
break;
}
export const config = _config; So now just import somewhere your config or you could provide this in your module and inject it somewhere, too. generated code e.g. Swagger Codegen export const BASE_PATH = new InjectionToken<string>('basePath'); app.module.ts import { BASE_PATH } from '../generated/variables';
import { config } from '../configs/config';
const SERVICES = [
...
{
provide: BASE_PATH,
useValue: config.API_BASE_PATH
},
...
]
@NgModule({
imports: [
...
ApiModule
...
],
providers: [
...SERVICES
]
})
export class AppModule {
} Yes this could be much more extended or simplified, but it is hard to find any real world, multi environments example, so I thought this could help a bit. |
This removes following warning: Remove warning: Without `from` option PostCSS could generate wrong source map or do not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning `from: the input file name (most runners set it automatically).` Source: https://github.com/postcss/postcss Fixes #1359 #13763 #1359 ionic-team/ionic-framework#13763
3.1.9: * fix(2889): fix build error with --prod * fix(serve): start listening when watch is ready * fix(live-server): update android platform path (ionic-team#1407) * docs(changelog): 3.1.9 3.1.10: * Update node-sass dependency (ionic-team#1435) Updating node-sass dependency from 4.7.2 to 4.9.0 to make it works with node 10 on windows (build fail with ionic start) * chore(package): bump deps (ionic-team#1421) * chore(deps): no package lock * chore(changelog): 3.1.10 3.1.11: * fix(serve): fix EADDRINUSE issue with dev logger server fixes ionic-team/ionic-cli#3368 fixes ionic-team/ionic-cli#1678 fixes ionic-team/ionic-cli#1830 fixes ionic-team/ionic-cli#1721 fixes ionic-team/ionic-cli#1866 fixes ionic-team/ionic-cli#1808 fixes ionic-team/ionic-cli#3022 * docs(changelog): 3.1.11 changes 3.2.0: * feat(environments): configuration via process.env.VAR replacement (ionic-team#1471) * fix(sass): remove PostCSS warning (ionic-team#1364) This removes following warning: Remove warning: Without `from` option PostCSS could generate wrong source map or do not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning `from: the input file name (most runners set it automatically).` Source: https://github.com/postcss/postcss Fixes ionic-team#1359 #13763 ionic-team#1359 ionic-team/ionic-framework#13763 * fix(serve): use wss protocol for secure websocket when page is using https (ionic-team#1358) * docs(changelog): 3.2.0 3.2.1: * docs(readme): add note about existing declaration addresses ionic-team/ionic-cli#3541 * chore(deps): update webpack to 3.12.0 (ionic-team#1477) * chore(deps): bump node-sass to 4.9.3 to fix security warnings (ionic-team#1483) * chore(deps): bump node-sass to 4.10.0 to fix security warnings (ionic-team#1493) * docs(changelog): 3.2.1
Short description of the problem:
After upgrading to [email protected], The config (process.env.***) variables are not exported to the project.
process.env.NODE_ENV --> should be 'dev' or 'prod'
console.log(process.env.NODE_ENV) = 'undefined'
Error:
Witout
from
option PostCSS could generate wrong source map or do not find Browserslist config. Set it to CSS file path or toundefined
to prevent this warningWhat behavior are you expecting?
Variables exported to project
Which @ionic/app-scripts version are you using?
3.1.7
Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)
The text was updated successfully, but these errors were encountered: