Code Monkey home page Code Monkey logo

Comments (10)

stnor avatar stnor commented on May 30, 2024 1

This is a safe approach should anyone else want to remove the warnings:

      new webpack.NormalModuleReplacementPlugin( // remove MathJax3 warnings
          /AsyncLoad\.js/,
          function (resource) {
            if (resource.context.endsWith('mathjax3/util')) {
              resource.request = resource.request.replace(/AsyncLoad/,'AsyncLoad-disabled');
            }
          }
      )

from mathjax-src.

dpvc avatar dpvc commented on May 30, 2024 1

Thanks for finding the solution!

from mathjax-src.

dpvc avatar dpvc commented on May 30, 2024

This is a duplicate of (part of) #88. This comment tells you how to work around the warning.

from mathjax-src.

stnor avatar stnor commented on May 30, 2024

I tried using the webpack (4.16.5) workaround with beta1 as described in #88 .

      new webpack.NormalModuleReplacementPlugin( // remove MathJax3 warnings
          /AsyncLoad\.js/,
          function (resource) {
            resource.request = resource.request.replace(/AsyncLoad/,"AsyncLoad-disabled");
          }
      )

However, I'm getting:

client:162 ./node_modules/mathjax3/mathjax3/input/mathml/MmlEntities.js
Module not found: Error: Can't resolve '../../util/AsyncLoad-disabled.js' in '/Users/stnor/devel/src/nomp/frontend/node_modules/mathjax3/mathjax3/input/mathml'
errors @ client:162

Also I'm thinking the regexp should be more specific to mathjax rather than everything matching /AsyncLoad.js/,

Any ideas?

from mathjax-src.

stnor avatar stnor commented on May 30, 2024

There doesn't seem to be any TS or JS version of "AsyncLoad-disabled.ts" in the beta.

from mathjax-src.

stnor avatar stnor commented on May 30, 2024

I'd rather wait for a new beta rather than creating a class for my app that would do the same as the (not) provided workaround.

from mathjax-src.

dpvc avatar dpvc commented on May 30, 2024

Also I'm thinking the regexp should be more specific to mathjax rather than everything matching /AsyncLoad.js/,

Sure, use whatever is necessary in your situation.

There doesn't seem to be any TS or JS version of "AsyncLoad-disabled.ts" in the beta.

I've just checked the GitHub beta branch and .ts file is there (See here), and I just downloaded the the npm packaged version, and both the files are there. (The .js files aren't stored on github, but are included in the npm package.)

Are you sure you are using the beta branch (if from GitHub), or the current version (if from npm)?

I'd rather wait for a new beta rather than creating a class for my app that would do the same as the (not) provided workaround.

I'm not sure I understand. The AsynchLoad.js file is not expected to change in the next beta, so waiting for beta.2 will not change this.

from mathjax-src.

stnor avatar stnor commented on May 30, 2024
  1. I have a massive JS app, and the best way i can limit the regexp is by using something like:
/\.\.\/util\/AsyncLoad\.js/ 

and that seems like too much of a risk to hit other libraries or my own code.
Would it be possible to make it include mathjax3 even though the imports are ..\util... in mathjax?

Ideally the regexp would match mathjax3/util/AsyncLoad only.

  1. Doh, I switched branch (master was using alpha1) and forgot to yarn install... sorry

from mathjax-src.

dpvc avatar dpvc commented on May 30, 2024

Would it be possible to make it include mathjax3 even though the imports are ..\util... in mathjax?

I'm not sure what "it" refers to in "make it include..." If you mean webpack, I'm afraid I am only a novice webpack user, and don't know if it is possible to force path expansion before the regex. Did you try /mathjax3\/util\/AsyncLoad\.js/ to see if it could be found that way?

If you mean MathJax itself, then I suppose it could be done by changing

import {asyncLoad} from '../../util/AsyncLoad.js';

to

import {asyncLoad} from '../../../mathjax3/util/AsyncLoad.js';

It looks like the only reference to AsyncLoad uses two sets of double dots, so you might be able to reduce the chance of incorrect matches by using

/\.\.\/\.\.\/util\/AsynchLoad\.js/

if that helps.

from mathjax-src.

stnor avatar stnor commented on May 30, 2024

I am not a webpack pro either, but I can conclude that the regexp only matches the path as specified in the import in mathjax3, hence I think the workaround is questionable. I'll try to look into this further.

from mathjax-src.

Related Issues (20)

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.