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.

UglifyJS fails to process tmi.js in my React/Webpack project

See original GitHub issue

Actual behaviour: When using tmi.js as a dependency in my React/Webpack/UglifyJS project, UglifyJS fails to process tmi.js.

Expected behaviour: UglifyJS processes tmi.js without error.

Error log:

Unexpected character '`'

… referring to the back-ticks in lib/*.js. It seems like tmi.js is not being compiled down to ES5.

Server configuration

  • Operating system: Windows 10
  • Node version (if applicable): 6/8
  • NPM version (if applicable): 3/5
  • tmi.js version: 1.2.1

Workaround

  1. Manually build tmi.js and import tmi.min.js into your project:
    import 'tmi.min.js'; // works; tmi is part of the global scope (not ideal)
    import tmi from 'tmi.min.js' // does NOT work; tmi is undefined
    
  2. Instruct Webpack to compile tmi.js when building by adding the following to your Webpack config’s module.loaders array:
    {
      // Compile  delinquent modules
      test: /\.js$/,
      loader: 'babel-loader',
      include: [
        // tmi.js
        path.dirname(require.resolve('tmi.js')),
      ],
      query: {
        babelrc: false,
        presets: ['es2015'],
      },
    }
    

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
ahadcovecommented, Aug 2, 2017

Nvm, I seen the PR you had and just installed that instead. Works perfectly, thanks for your help I hope this get’s merged soon

npm i -S marcandrews/tmi.js#bugfix/packaging
1reaction
AlcaDesigncommented, Jul 31, 2017

@AhadCove Download the latest minified version of tmi.js and put it wherever scripts go.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ERROR in bundle.js from UglifyJs - javascript - Stack Overflow
In my case i did changed sourceMap:false So error came like. ERROR in index.bundle.js from UglifyJs TypeError: Cannot read property 'sections' of null....
Read more >
Bot doesn't send message anymore and throws an error
Today, as a fun project, I tried making a Chatbot for the first time ever. I followed a tutorial, and i created it...
Read more >
README-Node.md - kaxap/arl - Sourcegraph
STARS FORKS ISSUES LAST COMMIT 95339 9729 176 15 days ago 61648 8464 324 28 days ago 44926 6686 67 17 days ago
Read more >
Welcome to Everything.js | Everything.js
Welcome to Everything.js. A curated list of awesome JavaScript frameworks, libraries and software. freeCodeCamp/freeCodeCamp - The https://www.
Read more >
Gitiles - Code Review - GerritHub
NET and Node.js code in-process on Windows, MacOS, ... project using GitHub Maven PluginsAKASH007045/javaThe Squash client library for Java ...
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