Permalink
Browse files

fix prod build

  • Loading branch information...
shprink committed Nov 14, 2017
1 parent f1d4ffa commit 7a954d1264818158245d78a08016ef72b7ef5ca3
View
@@ -44,6 +44,9 @@ before_build.md
/config.xml
www/
myapp/
src/**/*.js
src/**/*.js.map
.io-config.json
.sourcemaps
.sourcemaps
.temp
View
@@ -16,7 +16,7 @@ if (process.env.IONIC_ENV === 'prod') {
prodPlugins.push(new ModuleConcatPlugin());
}
module.exports = {
const webpackConfig = {
entry: process.env.IONIC_APP_ENTRY_POINT,
output: {
path: '{{BUILD}}',
@@ -63,15 +63,16 @@ module.exports = {
},
plugins: [
// ionicWebpackFactory.getIonicEnvironmentPlugin(),
ionicWebpackFactory.getCommonChunksPlugin(),
new webpack.DefinePlugin({
__VERSION__: JSON.stringify(getAppVersion()),
__DEV__: process.env.IONIC_ENV === 'dev',
__PROD__: process.env.IONIC_ENV === 'prod',
__SW_ENABLED__: JSON.stringify(RawConfig.serviceWorker.enabled),
__CONFIG_FOLDER__: JSON.stringify(process.env.IONIC_ROOT_DIR + '/config'),
}),
ionicWebpackFactory.getIonicEnvironmentPlugin(),
ionicWebpackFactory.getCommonChunksPlugin(),
new webpack.ContextReplacementPlugin(/moment\/locale$/, getRegexAutorizedLanguages()),
].concat(prodPlugins),
// Some libraries import Node modules but don't use them in the browser.
@@ -83,6 +84,15 @@ module.exports = {
}
};
module.exports = {
dev: webpackConfig,
prod: webpackConfig
}
function getRegexAutorizedLanguages() {
return new RegExp(RawConfig.language.imported.join('|'));
}
function getAppVersion() {
var config = new cordovaLib.configparser(path.join(__dirname, '..', 'config.xml'));
return config.version();
View
@@ -16,10 +16,6 @@ import { TranslateModule, TranslateLoader, TranslateService } from '@ngx-transla
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { WpApiModule, WpApiLoader, WpApiStaticLoader } from 'wp-api-angular'
// import { SharedWPHCModule } from '../src/app/app.module';
// import { WPHC } from '../src/app/app.component';
import { PAGES } from './pages/';
import { COMPONENTS } from './components/';
import { PIPES } from './pipes/';
@@ -31,7 +27,6 @@ export function createTranslateLoader(http: Http) {
}
export function WpApiLoaderFactory(http: any, config: Config) {
console.log("config.getApi('baseUrl', '')", config.getRaw())
return new WpApiStaticLoader(http, config.getApi('baseUrl', ''), config.getApi('namespace', ''));
}
@@ -49,7 +44,7 @@ export function appInitializerTranslateFactory(translate: TranslateService, inje
return () => new Promise<any>((resolve: any) => {
const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
locationInitialized.then(() => {
const defaultLanguage = config.get('defaultLanguage');
const defaultLanguage = config.getLanguage('default');
const browserLanguage = translate.getBrowserLang()
translate.setDefaultLang(defaultLanguage);
translate.use(browserLanguage || defaultLanguage).subscribe(() => {
@@ -65,8 +60,6 @@ export function appInitializerTranslateFactory(translate: TranslateService, inje
@NgModule({
imports: [
// CommonModule
// SharedWPHCModule,
HttpModule,
IonicModule,
MomentModule,
@@ -1,7 +1,9 @@
// Item
import { ItemPage } from '../../src/pages/item/item';
import { ItemPostsPage } from '../../src/pages/item/item-post';
import { ItemPagesPage } from '../../src/pages/item/item-page';
// List
import { ListPage } from '../../src/pages/list/list';
import { ListPostsPage } from '../../src/pages/list/list-posts';
import { ListPagesPage } from '../../src/pages/list/list-pages';
import { ListCategoriesPage } from '../../src/pages/list/list-categories';
@@ -12,6 +14,7 @@ import { ListAuthorsPage } from '../../src/pages/list/list-authors';
import { ListAuthorPage } from '../../src/pages/list/list-author';
// Rest
import { SearchPage } from '../../src/pages/search/search';
import { TabsPage } from '../../src/pages/tabs/tabs';
import { ParamsPage } from '../../src/pages/params/params';
import { BookmarksPage } from '../../src/pages/bookmarks/bookmarks';
import { TaxonomiesModal } from '../../src/pages/taxonomies-modal/taxonomies-modal';
@@ -72,9 +75,11 @@ export const DeepLinkerLnks = [
export const PAGES = [
// Items,
ItemPage,
ItemPostsPage,
ItemPagesPage,
// Lists,
ListPage,
ListPostsPage,
ListPagesPage,
ListCategoriesPage,
@@ -84,6 +89,7 @@ export const PAGES = [
ListAuthorsPage,
ListAuthorPage,
// Rest
TabsPage,
ParamsPage,
SearchPage,
BookmarksPage,
Oops, something went wrong.

0 comments on commit 7a954d1

Please sign in to comment.