Skip to content
This repository was archived by the owner on Mar 6, 2020. It is now read-only.
This repository was archived by the owner on Mar 6, 2020. It is now read-only.

Question: Why use require compare to import statement ? #6

@MangelMaxime

Description

@MangelMaxime

Hello,
I am starting to play with FlimFlam and I decided to go with Rollup (ES6) + Gulp for the build tasks.

I had some problem with those lines:

const patch = snabbdom.init([
  require('snabbdom/modules/class')
, require('snabbdom/modules/props')
, require('snabbdom/modules/style')
, require('snabbdom/modules/eventlisteners')
])

I was having an error: Uncaught ReferenceError: require is not defined

I tryed to use:

import sClass from 'snabbdom/modules/class'
import sProps from 'snabbdom/modules/props'
import sStyle from 'snabbdom/modules/style'
import sEventlisteners from 'snabbdom/modules/eventlisteners'

const patch = snabbdom.init([
    sClass, sProps, sStyle, sEventlisteners
])

And with now it's working. Is there any reason to prefer require compare to import ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions