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.

Import not working with webpack+babel

See original GitHub issue

I’d like to use chartist in the manner below. My workflow uses webpack and babel.

import Chartist from ‘chartist’;

This throws the following in the browser: Uncaught TypeError: Cannot set property 'Chartist' of undefined

I have got around this by forking chartist and tweaking the factory code in the manner described here: https://github.com/gregjacobs/Autolinker.js/issues/86#issuecomment-74487812

It would be great if this could be incorporated into the master branch.

Issue Analytics

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

github_iconTop GitHub Comments

7reactions
mlg87commented, Jul 24, 2018

three years later, and this still seems to be an issue. why is this closed? both import Chartist from 'chartist' and require('chartist') lead to this error for me

edit: using 0.10.1

4reactions
MartinMuzatkocommented, Sep 26, 2017

Import works flawlessly. As stated in another issue, not all plugins return functions.

import Chartist from 'chartist' worked perfectly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plain "import" is not working with webpack and babel-loader
In my main.js I imported some other js files which do not have export statements. //main.js import './file1' instead import styles from '....
Read more >
Dynamic imports not working (TypeScript, Babel) #8669
My dynamic imports are not working although I think I have configured things correctly. The error: ERROR in ./src/js/utils/getIconUrl.ts 4:2 ...
Read more >
Module Methods
Version 2 of webpack supports ES6 module syntax natively, meaning you can use import and export without a tool like babel to handle...
Read more >
Working with Babel 7 and Webpack | The Basement
The easiest way to import the polyfills provided by Babel is by including it in your entry point in Webpack. Change your webpack.config.js...
Read more >
Fixing WebpackChunkName for Dynamic Imports - Time to Hack
Are the Webpack Magic Comments webpackChunkName not effective and working with Babel? See how to Fix it and Tips to avoid related problems....
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