Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

172
Vistas
Use Summernote with Webpack

I'm trying to get Summernote working with Webpack, but somehow it does not work.

I installed summernote with yarn yarn add summernote.

In my javascript file I'm importing webpack:

import $ from 'jquery';
import 'bootstrap';
import 'summernote/dist/summernote';

$('#summernote').summernote({});

But I'm getting the error:

Uncaught TypeError: jquery__WEBPACK_IMPORTED_MODULE_0___default()(...).summernote is not a function

If I use the summernote js from the dist folder, I also get this error on my webpack console (I don't have this error when importing summernote.js from the src directory (import 'summernote/src/js/summernote.js')):

warning  in ./node_modules/jQuery/dist/jquery.js

There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:
* /path/to/node_modules/jQuery/dist/jquery.js
    Used by 1 module(s), i. e.
    /path/to/node_modules/summernote/dist/summernote.js
* /path/to/node_modules/jquery/dist/jquery.js
    Used by 534 module(s), i. e.
    /path/to/node_modules/babel-loader/lib/index.js??ref--4-0!/path/to/assets/js/app.js

I tried this: enter link description here, but same result.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Problem

I think the issue here is to require the wrong jquery package name when the repo has been built with webpack. I did have a look at the built code and here is jquery required:

module.exports = factory(require("jQuery")); // this should be `jquery` instead

Also there's a ticket raised but it seems nothing got fixed.

Solution

Luckily webpack allows us to define how a module is resolved by listing the module in resolve.alias as following:

// webpack.config.js

const path from "path";

module.exports = {
  // ...
  resolve: {
    alias: {
      // resolve `jQuery` with actual `jquery` module
      jQuery: path.resolve(__dirname, "node_modules/jquery"),
    },
  },
  // ...
};

PS: Based on your comment which is using Symfony you can modify and add an alias to jQuery like this:

// fetch the config, then modify it!
const config = Encore.getWebpackConfig();

// Add another alias to jQuery
config.resolve.alias.jQuery = path.resolve(__dirname, "node_modules/jquery")

module.exports = config;
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda