jcsmorais / shortcut-buttons-flatpickr

Flatpickr's plugin that provides users an alternative way to interact with the datetime picker.
MIT License
26 stars 15 forks source link

Error in production build #7

Closed sAnti09 closed 5 years ago

sAnti09 commented 6 years ago

It works in development but has either of the ff. errors in production.

Error 1:

ERROR in vendor-bundle-025d2a7274f90be4f253.js from UglifyJs
Unexpected token: operator (>) [vendor-bundle-025d2a7274f90be4f253.js:130115,17]

ERROR in vendor-bundle-025d2a7274f90be4f253.js from UglifyJs
Unexpected token: operator (>) [vendor-bundle-025d2a7274f90be4f253.js:130115,17]

Error 2:

ERROR in ./node_modules/shortcut-buttons-flatpickr/dist/types/index.d.ts
Module parse failed: /Users/james/Documents/workspace/rails/dbocl/client/node_modules/shortcut-buttons-flatpickr/dist/types/index.d.ts Unexpected token (2:7)
You may need an appropriate loader to handle this file type.
| import { Instance as Flatpickr } from 'flatpickr/dist/types/instance.d';
| export declare namespace ShortcutButtonsFlatpickr {
|     type OnClickSignature = (index: number, fp: Flatpickr) => void;
|     type Button = {
 @ ./app/v2/_widgets/forms/DateTimeField.tsx 32:28-84
 @ ./app/v2/eventGroup/productionScheduleReport/components/Filters.tsx
 @ ./app/v2/eventGroup/productionScheduleReport/components/ProductionScheduleReport.tsx
 @ ./app/v2/eventGroup/productionScheduleReport/containers/ProductionScheduleReport.tsx
 @ ./app/v2/AppRouter.tsx
 @ ./app/v2/main/components/App.tsx
 @ ./app/v2/main/containers/App.tsx
 @ ./app/v2/_boot/index.tsx
 @ multi es5-shim/es5-shim es5-shim/es5-sham babel-polyfill ./app/v2/_boot/index
jcsmorais commented 6 years ago

Hi @sAnti09,

Thanks for reporting this issue.

Can you elaborate more on what you're doing and how so that's it's becomes easy to try to reproduce the behavior?

Namely:

  1. which environment you're running on
  2. which browser (version included)
  3. which version of flatpickr
  4. which version of shortcut-buttons-flatpickr

The errors you posted aren't saying much..

Unexpected token: operator (>) [vendor-bundle-025d2a7274f90be4f253.js:130115,17]

Can you post the piece of code where it's breaking on?

Thanks.

sAnti09 commented 6 years ago

I'm trying to build the project for production.

  1. NODE_ENV=production
  2. Didn't need to run in browser since error throws during webpack build for production.
  3. "flatpickr": "^4.1.0", "@types/flatpickr": "^3.1.2"
  4. "shortcut-buttons-flatpickr": "^0.2.3"

Yes, the errors doesn't say much. That's all I got too.

Actually I've been able to run it nicely in development using import ShortcutButtonsPlugin from 'shortcut-buttons-flatpickr/dist/shortcut-buttons-flatpickr'. The problem is when I build for production.

jcsmorais commented 5 years ago

@sAnti09 can you try to import with the following path?

import { ShortcutButtonsPlugin } from 'shortcut-buttons-flatpickr/dist/types/index.d';
sAnti09 commented 5 years ago

Yes. It doesn't work @jcsmorais.

ERROR in ./node_modules/shortcut-buttons-flatpickr/dist/types/index.d.ts
Module parse failed: /Users/james/Documents/workspace/rails/dbocl/client/node_modules/shortcut-buttons-flatpickr/dist/types/index.d.ts Unexpected token (2:7)
You may need an appropriate loader to handle this file type.
| import { Instance as Flatpickr } from 'flatpickr/dist/types/instance.d';
| export declare namespace ShortcutButtonsFlatpickr {
|     type OnClickSignature = (index: number, fp: Flatpickr) => void;
jcsmorais commented 5 years ago

@sAnti09 that might be a webpack configuration related error, have you seen this thread: https://github.com/TypeStrong/ts-loader/issues/742 ?

Hopefully it'll shed some light, if it doesn't, maybe you can provide the steps/files to reproduce the behavior you're seeing.