jump to navigation

“emitted file Xyz.d.ts overwites a previously emitted file of the same name” May 1, 2020

Posted by kevinbe71 in Development, React, TypeScript, Uncategorized, Web Development.
Tags: , , , ,
add a comment

After making some recent changes and then upgrading rollup to 2.7.6 (from a 1.x release) I started seeing 2 of these warnings appear:

(!) The emitted file “actions\Xyz.d.ts” overwrites a previously emitted file of the same name.
(!) The emitted file “actions\Xyz.d.ts” overwrites a previously emitted file of the same name.

I used git bisect to quickly track down the commit that caused this issue and, fortunately, it was pretty obvious then:

I had 2 variations of imports of this file:
import * as Xyz from “./Xyz”;
import * as Xyz from “./xyz”;

This may not jump out to you immediately but the difference is a camelCase name vs a PascalCase name of the same file. The true file was called “xyz” but if you’re using Mac OS X or Windows then the compiler actually permits this. The newer version of rollup wasn’t letting things be… if wasn’t happy (which was a good thing)!

Cannot Read Property Pathname of Undefined September 1, 2019

Posted by kevinbe71 in Development, Javascript, node, React, TypeScript, Web Development.
Tags: ,
add a comment

A new project I recently started requires a universal app and an electron client. I had already got the base of the SSR part done so I moved on to the electron app. I had started the whole project off with a template but it didn’t have the electron part, so I had to add that myself.

It was actually quite tough to get everything together for the electron app as I wanted it to use TypeScript and that necessitated two webpack configs (one for the main script and the other for the renderer).

Anyway, once I had that working I ran into one final problem: “Uncaught TypeError: Cannot read property ‘pathname’ of undefined” in the react-router.js file. It occurred on a line that was referencing “this.state.location.pathname”

I didn’t find an answer by doing a lot of scouring of the web. As a consequence I started reading the docs: electron, redux, and react router’s docs to be specific. Eventually I saw something that caught my eye: “import { BrowserRouter as Router, Route } from ‘react-router-dom'” – BrowserRouter AS Router! Wow, that’s pretty easy to miss: in all of the source code I’d reviewed I’d seen “” but hadn’t looked closely enough at the import statement (or perhaps it was missing?) In any case, this resolve the error.

redux-api-middleware – iconv-loader warning August 15, 2016

Posted by kevinbe71 in Development, Javascript.
Tags: , , , , , ,
add a comment

I recently ran into an error using webpack with an electron based app I’m working on.  The error manifested from a webpack warning:

WARNING in [...base path removed...]~/encoding/lib/iconv-loader.js
Critical dependencies:
9:12-34 the request of a dependency is an expression
 @ [...base path removed...]~/encoding/lib/iconv-loader.js 9:12-34

How I ended up with this was:

  • I produced an isomorphic web app with react, redux and redux-api-middleware (using a gulpfile to bundle it because that’s what the yeoman template used).
  • I thought it would be great to share common code with an electron-based desktop app I was working on (using webpack because that’s what I’d chosen to use).
  • I combined code and ran into the error.

To help resolve the issue I explored a few web pages and found this one that solved the problem (thanks Jim Pick!): https://github.com/andris9/encoding/issues/16

I added the following to my webpack.config.js:

 plugins: [
   ... other plugins listed here ...,
   new webpack.NormalModuleReplacementPlugin(
       /\/iconv-loader$/, 'node-noop'
   )
 ]

 

Design a site like this with WordPress.com
Get started