Giter Site home page Giter Site logo

repro-default-export's Introduction

Bug Reproduction repository

Related issues:

Install

run bash init.sh

What's wrong?

In src/index.ts:

import createElement from 'inferno-create-element'
import Component from 'inferno-component'

console.log(createElement)
console.log(Component)

createElement and Component should have the value of the related package default export.

Though, if you run node dist/bundle.js, you'll get undefined

If you check out the compiled file, you will see something like:

const inferno_create_element_1 = __webpack_require__(3);
const inferno_component_1 = __webpack_require__(2);
console.log(inferno_create_element_1.default);
console.log(inferno_component_1.default);

But, rollup (which is used by Inferno) doesn't export any default:

true ? module.exports = factory(__webpack_require__(0)) :
typeof define === 'function' && define.amd ? define(['inferno'], factory) :
(global.Inferno = global.Inferno || {}, global.Inferno.createElement = factory(global.Inferno));

An alternative is to use the following import statements:

import * as createElement from 'inferno-create-element'
import * as Component from 'inferno-component'

console.log(createElement)
console.log(Component)

But by using this, typescript expects Objects and the module signatures are wrong, and therefore blocking the compilation.

For example, you won't be able to extend Component, because it's not recognized as a class.

Version used:

repro-default-export's People

Stargazers

 avatar

Watchers

James Cloos avatar Antoine Bluchet avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.