question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

In ES6 projects overflows console with typescript warning

See original GitHub issue

Sorry, I don’t know how to demonstrate this on a JSFiddle, as I can’t see the console output there.

I do NOT use Typescript, but ES6 via Babel.

After upgrade from 4.2.0 to 4.2.1 (or any higher version) the project build and the browser console is overflown with 111 messages. This effectively prevents development of the app, as I need to have the console clean to easily spot any issues with my own code.

Browser console output:

[HMR] bundle has 111 warnings
./node_modules/flatpickr/dist/l10n/ar.d.ts
Module parse failed: /home/..../frontend/node_modules/flatpickr/dist/l10n/ar.d.ts Unexpected token (2:7)
You may need an appropriate loader to handle this file type.
| import { CustomLocale } from "../types/locale";
| export declare const Arabic: CustomLocale;
| declare const _default: {
|     ar?: CustomLocale | undefined;
 @ ./node_modules/flatpickr/dist/l10n ^\.\/.*$
 @ ./src/main.js
 @ multi ./build/dev-client ./src/main.js
./node_modules/flatpickr/dist/l10n/bg.d.ts
Module parse failed: /home/..../frontend/node_modules/flatpickr/dist/l10n/bg.d.ts Unexpected token (2:7)
You may need an appropriate loader to handle this file type.
| import { CustomLocale } from "../types/locale";
| export declare const Bulgarian: CustomLocale;
| declare const _default: {
|     ar?: CustomLocale | undefined;
 @ ./node_modules/flatpickr/dist/l10n ^\.\/.*$
 @ ./src/main.js
 @ multi ./build/dev-client ./src/main.js
./node_modules/flatpickr/dist/l10n/bn.d.ts
Module parse failed: /home/..../frontend/node_modules/flatpickr/dist/l10n/bn.d.ts Unexpected token (2:7)
You may need an appropriate loader to handle this file type.
| import { CustomLocale } from "../types/locale";
| export declare const Bangla: CustomLocale;
| declare const _default: {
|     ar?: CustomLocale | undefined;
 @ ./node_modules/flatpickr/dist/l10n ^\.\/.*$
 @ ./src/main.js
 @ multi ./build/dev-client ./src/main.js
./node_modules/flatpickr/dist/l10n/cat.d.ts
Module parse failed: /home/..../frontend/node_modules/flatpickr/dist/l10n/cat.d.ts Unexpected token (2:7)
You may need an appropriate loader to handle this file type.
| import { CustomLocale } from "../types/locale";
|

etc. the rest omitted.

I would assume that this is related to issue #1131 and commit 6b4ff17d7b0c33353413f391b90a56a7075c5cd9. (I might also speculate that maybe some dist JS files refer to .ts files?)

Please advise how to get rid of these messages.

Your Environment

  • flatpickr version used: 4.2.1
  • Browser name and version: Chrome
  • OS and version: Centos 7.1

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ivoscommented, May 13, 2018

Just for the info, I have finally found the cause.

The require call for flatpickr locale assumed a .js extension will be added by webpack by default, but the .d.ts file was loaded as well. Changing it to this made the trick:

flatpickrLocaleImport = require(`flatpickr/dist/l10n/${locale}.js`).default[locale]

My bad.

0reactions
ivoscommented, May 13, 2018

Created a new plain project with just flatpickr and could not reproduce the issue. Probably something with the vue component wrapper. Sorry.

Read more comments on GitHub >

github_iconTop Results From Across the Web

nuxt.js - bundle 'client' has 221 warnings in typescript in console
I solved My Issue By changing the tsconfig.json. from This: { "compilerOptions": { "target": "ESNext", "module": "ESNext", ...
Read more >
Documentation - ECMAScript Modules in Node.js - TypeScript
This setting controls whether .js files are interpreted as ES modules or CommonJS modules, and defaults to CommonJS when not set. When a...
Read more >
TypeScript: JavaScript With Syntax For Types.
TypeScript extends JavaScript by adding types to the language. TypeScript speeds up your development experience by catching errors and providing fixes ...
Read more >
TSConfig Reference - Docs on every TSConfig option
Project references are a way to structure your TypeScript programs into ... These warnings are only about code which is provably unreachable due...
Read more >
The starting point for learning TypeScript
Find TypeScript starter projects: from Angular to React or Node.js and CLIs.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found