Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): change moment/lodash imports so it works with ES6 module #210

Merged
merged 1 commit into from
Dec 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/common/src/editors/dateEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as moment_ from 'moment-mini';
import { BaseOptions as FlatpickrBaseOptions } from 'flatpickr/dist/types/options';
import { FlatpickrFn } from 'flatpickr/dist/types/instance';
const flatpickr: FlatpickrFn = _flatpickr as any; // patch for rollup
const moment = moment_; // patch to fix rollup "moment has no default export" issue, document here https://github.com/rollup/rollup/issues/670
const moment = moment_['default'] || moment_; // patch to fix rollup "moment has no default export" issue, document here https://github.com/rollup/rollup/issues/670

import { Constants } from './../constants';
import { FieldType } from '../enums/index';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { mapMomentDateFormatWithFieldType } from './../services/utilities';
import { testFilterCondition } from './filterUtilities';
import * as moment_ from 'moment-mini';

const moment = moment_; // patch to fix rollup "moment has no default export" issue, document here https://github.com/rollup/rollup/issues/670
const moment = moment_['default'] || moment_; // patch to fix rollup "moment has no default export" issue, document here https://github.com/rollup/rollup/issues/670

export const executeMappedCondition: FilterCondition = (options: FilterConditionOption) => {
// when using a multi-select ('IN' operator) we will not use the field type but instead go directly with a collection search
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/filters/dateRangeFilter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as flatpickr from 'flatpickr';
import * as moment_ from 'moment-mini';
const moment = moment_; // patch to fix rollup "moment has no default export" issue, document here https://github.com/rollup/rollup/issues/670
const moment = moment_['default'] || moment_; // patch to fix rollup "moment has no default export" issue, document here https://github.com/rollup/rollup/issues/670

import {
FieldType,
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/formatters/formatterUtilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { FieldType } from '../enums/fieldType.enum';
import { Column, Formatter, GridOption, SlickGrid } from '../interfaces/index';
import { mapMomentDateFormatWithFieldType } from '../services/utilities';
import * as moment_ from 'moment-mini';
const moment = moment_; // patch to fix rollup "moment has no default export" issue, document here https://github.com/rollup/rollup/issues/670
const moment = moment_['default'] || moment_; // patch to fix rollup "moment has no default export" issue, document here https://github.com/rollup/rollup/issues/670

/**
* Find the option value from the following (in order of execution)
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/services/filter.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as isequal_ from 'lodash.isequal';
const isequal = isequal_; // patch to fix rollup to work
const isequal = isequal_['default'] || isequal_; // patch to fix rollup to work

import { FilterConditions } from './../filter-conditions/index';
import { FilterFactory } from './../filters/filterFactory';
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/services/gridState.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as isequal_ from 'lodash.isequal';
const isequal = isequal_; // patch to fix rollup to work
const isequal = isequal_['default'] || isequal_; // patch to fix rollup to work

import {
ExtensionName,
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/services/pagination.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as isequal_ from 'lodash.isequal';
const isequal = isequal_; // patch to fix rollup to work
const isequal = isequal_['default'] || isequal_; // patch to fix rollup to work

import {
BackendServiceApi,
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/services/utilities.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as DOMPurify_ from 'dompurify';
import * as moment_ from 'moment-mini';
const DOMPurify = DOMPurify_; // patch to fix rollup to work
const moment = moment_; // patch to fix rollup "moment has no default export" issue, document here https://github.com/rollup/rollup/issues/670
const moment = moment_['default'] || moment_; // patch to fix rollup "moment has no default export" issue, document here https://github.com/rollup/rollup/issues/670

import { FieldType, OperatorString, OperatorType } from '../enums/index';
import { GridOption } from '../interfaces/index';
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/sortComparers/dateUtilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { mapMomentDateFormatWithFieldType } from '../services/utilities';
import { FieldType } from '../enums/fieldType.enum';
import { Column, GridOption, SortComparer } from '../interfaces/index';
import * as moment_ from 'moment-mini';
const moment = moment_; // patch to fix rollup "moment has no default export" issue, document here https://github.com/rollup/rollup/issues/670
const moment = moment_['default'] || moment_; // patch to fix rollup "moment has no default export" issue, document here https://github.com/rollup/rollup/issues/670

export function compareDates(value1: any, value2: any, sortDirection: number, sortColumn: Column, gridOptions: GridOption, format: string | moment_.MomentBuiltinFormat, strict?: boolean) {
let diff = 0;
Expand Down
2 changes: 1 addition & 1 deletion packages/excel-export/src/excelExport.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as ExcelBuilder from 'excel-builder-webpacker';
import * as moment_ from 'moment-mini';
const moment = moment_; // patch to fix rollup "moment has no default export" issue, document here https://github.com/rollup/rollup/issues/670
const moment = moment_['default'] || moment_; // patch to fix rollup "moment has no default export" issue, document here https://github.com/rollup/rollup/issues/670

import {
// utility functions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as moment_ from 'moment-mini';
const moment = moment_; // patch to fix rollup "moment has no default export" issue, document here https://github.com/rollup/rollup/issues/670
const moment = moment_['default'] || moment_; // patch to fix rollup "moment has no default export" issue, document here https://github.com/rollup/rollup/issues/670

import {
Constants,
Expand Down