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.

Browserified search addon includes a copy of Terminal

See original GitHub issue

Regressed in https://github.com/sourcelair/xterm.js/pull/834

When browserify sees this:

module.exports = addon(require('../../xterm'));

It merges all of xterm into this file. One way to work around this is to pull the string out so browserify doesn’t pick it up:

const xterm = '../../xterm';
module.exports = addon(require(xterm));

This produces a warning in webpack:

WARNING in ../~/xterm/lib/addons/search/search.js
10:31-45 Critical dependency: the request of a dependency is an expression

This warning is preferable really, I wonder if there is a better way to build something (search addon) that depends on a lib (xterm.js) without packaging the lib with it.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
Tyriarcommented, Aug 27, 2017

Possible fix is for instead of search.ts to find Terminal.ts, have Terminal.loadAddon load the addon and then pass Terminal into it.

In search.ts:

    /**
     * CommonJS environment
     */
    module.exports = addon;

In Terminal.ts:

public static loadAddon(addon: string, callback?: Function): boolean | any {
    // TODO: Improve return type and documentation
    if (typeof exports === 'object' && typeof module === 'object') {
      // CommonJS
      return require('./addons/' + addon + '/' + addon)(Terminal);
    } else if (typeof define === 'function') {
...
0reactions
Tyriarcommented, Oct 2, 2017

I’m consolidating all bundling/loadAddon related issues into https://github.com/sourcelair/xterm.js/issues/1018, please comment on that issue if you have thoughts 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Browserify
Browserify lets you require('modules') in the browser by bundling up all of your dependencies. Install Documentation · Source Code · Help + Articles...
Read more >
How to Polyfill node core modules in webpack 5
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if...
Read more >
npm start not working in vs code terminal
Update: Since version 1.3 Visual Studio Code has integrated terminal. To open it, use any of these methods: Use the Ctrl + `...
Read more >
Setting Up CanJS | getting started | Guides
StealJS; webpack; Browserify; DoneJS; Script tags setups; Hosted traditional ... Copy. This file is large as it includes nearly every extension to CanJS....
Read more >
Webpack or Browserify & Gulp: Which Is Better?
Bundle our JS & CSS files (including ES6 to ES5 transpilation, SASS to CSS conversion and sourcemaps) in a scalable manner on watched...
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