Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

214
Views
Error using underscore and webpack together

I have an older webapp that uses React but also some older libraries. I am using Webpack 5 to bundle my files.

When I start the app, I get this error:

Uncaught TypeError: underscore__WEBPACK_IMPORTED_MODULE_1__.default.noConflict is not a function

Its on this line in the EntryPoint.js file:

var  underscore = _.noConflict();

And it's used like this:

import _ from 'underscore';
import Backbone from 'backbone';
import $ from 'jquery';

$.noConflict(true);
Backbone.noConflict();

// error here
var  underscore = _.noConflict();

underscore.templateSettings = {
    interpolate: /\{\{(.+?)\}\}/g, 
    evaluate: /\{%([\s\S]+?)%\}
};

I also tried this:

import underscore from 'underscore';
import Backbone from 'backbone';
import $ from 'jquery';

$.noConflict(true);
Backbone.noConflict();

// error here
underscore.noConflict();

underscore.templateSettings = {
    interpolate: /\{\{(.+?)\}\}/g, 
    evaluate: /\{%([\s\S]+?)%\}
};

I believe i am using it correctly based on the underscore docs:

https://underscorejs.org/#noConflict

Does anyone know what could be causing this?

Thanks!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!