Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpack and CodeMirror #1171

Closed
mathieumg opened this issue Jun 22, 2015 · 26 comments

Comments

@mathieumg
Copy link
Contributor

commented Jun 22, 2015

The "fix" in #379 actually broke the way we use Summernote. We leverage Webpack to package our front-end assets and it statically analyzes require calls/AMD definitions to prebundle modules and transforms those calls into __webpack__require__() for the front-end.

Summernote used to ask for CodeMirror (which we do want to use) along jQuery as AMD dependencies (which Webpack understands correctly) and it still asks for CodeMirror as an AMD dependency, but elsewhere, everything about that still works fine. However, what this change broke is that it now tries to use require.specified which is RequireJS-specific as far as I know and which Webpack doesn't understand. (It transforms the call into __webpack__require__().specified as a best effort and complains about the file being unable to be analyzed statically)

Do you think there could be a way to achieve the same end goal while pleasing everyone's requirements here? With the "old way" perhaps there is way to work around not having CodeMirror even though it's set as a dependency: http://stackoverflow.com/a/27422370/564163

In the meantime, if another webpack user is met with same issue, you can do a dirty hack and leverage the DefinePlugin to transform require.specified calls into require.resolve calls, which return the internal webpack ID of the module (which is always a positive number and thus truthy). It won't work if you don't want/have CodeMirror.

Related: #487

Thank you!

@anatoliyarkhipov

This comment has been minimized.

Copy link

commented Jun 23, 2015

Hi, I just tried to use summernote with webpack and got the same problem. Can you please explain more detailed how to implement this dirty hack?

@mathieumg

This comment has been minimized.

Copy link
Contributor Author

commented Jun 23, 2015

In your Webpack plugin list (https://webpack.github.io/docs/configuration.html#plugins) add:

new webpack.DefinePlugin({
  "require.specified": "require.resolve"
})

This is not a good permanent solution for the reasons mentioned above.

@aaronroberson

This comment has been minimized.

Copy link

commented Jun 23, 2015

+1

@littlee

This comment has been minimized.

Copy link

commented Aug 5, 2015

@mathieumg
I add the code you provided in my webpack.config.js

but still get this error:

    ERROR in ./js/libs/summernote/summernote.js
    Module not found: Error: Cannot resolve module 'CodeMirror' in E:\COOKA\webpack\js\libs\summernote
    @ ./js/libs/summernote/summernote.js 186:34-65 4900:6-4902:8

my config file:

var path = require("path");
var webpack = require("webpack");
var I18nPlugin = require("i18n-webpack-plugin");
var languages = {
    "en_US": null,
    "zh_CN": require("./js/i18n/zh_CN.json")
};
module.exports = Object.keys(languages).map(function(language) {
    return {
        name: language,
        entry: {
            page1: './js/page1.js'
        },
        output: {
            path: path.join(__dirname, "js/build"),
            filename: language + ".[name].js",
            publicPath: './js/build'
        },
        plugins: [
            new I18nPlugin(
                languages[language]
            ),
            new webpack.ProvidePlugin({
                $: "jquery",
                jQuery: "jquery",
                "window.jQuery": "jquery"
            }),
            new webpack.DefinePlugin({
                "require.specified": "require.resolve"
            })
        ]
    };
});

my entry file:

console.log(__('this is page 1'));

require('./libs/summernote/summernote.js');

$(document).ready(function() {
    $('#sum').summernote({
        height: 300,
        minHeight: null,
        maxHeight: null
    });
});
@mathieumg

This comment has been minimized.

Copy link
Contributor Author

commented Aug 5, 2015

From my original post, above:

It won't work if you don't want/have CodeMirror.

@itsazzad

This comment has been minimized.

Copy link

commented Aug 5, 2015

@mathieumg CodeMirror is installed using bower but its not resolved as an alias in webpack and I dont know also how to resolve that but in webpack.js plugins I have:

      plugins: [
        new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js'),
        new webpack.DefinePlugin({
          "require.specified": "require.resolve"
        })
      ],

and im getting error:
ERROR in ./bower_components/summernote/dist/summernote.js Module not found: Error: Cannot resolve module 'CodeMirror' in bower_components/summernote/dist @ ./bower_components/summernote/dist/summernote.js

@mathieumg

This comment has been minimized.

Copy link
Contributor Author

commented Aug 5, 2015

@itsazzad Are you @littlee ?

Do you successfully resolve other Bower components in your current webpack build? bower_components is not looked into by default, you have to add it: https://webpack.github.io/docs/usage-with-bower.html

However, as mentioned in that page, it is better to prefer the npm versions when they exist. I don't know under what format Summernote and CodeMirror bundle themselves for Bower, but I can attest that it works using the npm versions.

@itsazzad

This comment has been minimized.

Copy link

commented Aug 5, 2015

@mathieumg, no i am not littlee.
Other bower components are working fine.
However seems to be that I could solve in this way :

          'CodeMirror':           path.resolve(__dirname, '../bower_components/codemirror/lib/codemirror'),

And I got the path format from http://codemirror.net/doc/manual.html#modloader

Thanks for the guidelines...

@littlee

This comment has been minimized.

Copy link

commented Aug 6, 2015

I fix it incidentally whatever.
When I see the error, I always type npm install CodeMirror,
but it should be npm install codemirror,
and the code below is also needed in config file:

            new webpack.DefinePlugin({
                "require.specified": "require.resolve"
            })
@graingert

This comment has been minimized.

Copy link
Contributor

commented Jan 19, 2016

@brwr you didn't create a PR with your fix: #1629

@graingert

This comment has been minimized.

Copy link
Contributor

commented Jan 19, 2016

FYI if you don't want to install CodeMirror you can do:

// webpack.config.js
module.exports = {
    ...
    resolve: {
        alias: {
            CodeMirror: './path/to/fake/codemirror',
            codemirror: './path/to/fake/codemirror',
        }
    }
@mathieumg

This comment has been minimized.

Copy link
Contributor Author

commented Jan 19, 2016

Why not just leverage the IgnorePlugin?

@graingert

This comment has been minimized.

Copy link
Contributor

commented Jan 19, 2016

@mathieumg that's a good point. I will leverage the IgnorePlugin instead

@hackerwins

This comment has been minimized.

Copy link
Member

commented Jan 27, 2016

I hope this example is helpful.
https://github.com/hackerwins/summernote-webpack-example

@item4

This comment has been minimized.

Copy link

commented Mar 16, 2016

@hackerwins your source not work now

summernote-webpack-example@1.0.0 /Users/item4/Projects/summernote-webpack-example
├── bootstrap@3.3.6
├── codemirror@5.12.0
├─┬ css-loader@0.23.1
│ ├─┬ css-selector-tokenizer@0.5.4
│ │ ├── cssesc@0.1.0
│ │ └── fastparse@1.1.1
│ ├─┬ cssnano@3.5.2
│ │ ├─┬ autoprefixer@6.3.3
│ │ │ ├── browserslist@1.1.3
│ │ │ ├── caniuse-db@1.0.30000430
│ │ │ ├── normalize-range@0.1.2
│ │ │ └── num2fraction@1.2.2
│ │ ├── decamelize@1.2.0
│ │ ├── defined@1.0.0
│ │ ├── indexes-of@1.0.1
│ │ ├─┬ postcss-calc@5.2.0
│ │ │ ├── postcss-message-helpers@2.0.0
│ │ │ └─┬ reduce-css-calc@1.2.1
│ │ │   ├── balanced-match@0.1.0
│ │ │   └── reduce-function-call@1.0.1
│ │ ├─┬ postcss-colormin@2.2.0
│ │ │ └─┬ colormin@1.1.0
│ │ │   ├─┬ color@0.11.1
│ │ │   │ ├── color-convert@0.5.3
│ │ │   │ └─┬ color-string@0.3.0
│ │ │   │   └── color-name@1.1.1
│ │ │   └── css-color-names@0.0.3
│ │ ├── postcss-convert-values@2.3.4
│ │ ├── postcss-discard-comments@2.0.4
│ │ ├── postcss-discard-duplicates@2.0.1
│ │ ├── postcss-discard-empty@2.0.1
│ │ ├─┬ postcss-discard-unused@2.2.1
│ │ │ ├── flatten@1.0.2
│ │ │ └── uniqs@2.0.0
│ │ ├─┬ postcss-filter-plugins@2.0.0
│ │ │ └── uniqid@1.0.0
│ │ ├─┬ postcss-merge-idents@2.1.5
│ │ │ └── has-own@1.0.0
│ │ ├── postcss-merge-longhand@2.0.1
│ │ ├── postcss-merge-rules@2.0.6
│ │ ├── postcss-minify-font-values@1.0.3
│ │ ├── postcss-minify-gradients@1.0.1
│ │ ├─┬ postcss-minify-params@1.0.4
│ │ │ └── alphanum-sort@1.0.2
│ │ ├─┬ postcss-minify-selectors@2.0.4
│ │ │ └─┬ postcss-selector-parser@1.3.3
│ │ │   └── uniq@1.0.1
│ │ ├── postcss-normalize-charset@1.1.0
│ │ ├─┬ postcss-normalize-url@3.0.7
│ │ │ ├── is-absolute-url@2.0.0
│ │ │ └─┬ normalize-url@1.4.1
│ │ │   ├── prepend-http@1.0.3
│ │ │   ├─┬ query-string@3.0.1
│ │ │   │ └── strict-uri-encode@1.1.0
│ │ │   └─┬ sort-keys@1.1.1
│ │ │     └── is-plain-obj@1.1.0
│ │ ├── postcss-ordered-values@2.1.0
│ │ ├── postcss-reduce-idents@2.3.0
│ │ ├── postcss-reduce-transforms@1.0.3
│ │ ├─┬ postcss-svgo@2.1.2
│ │ │ ├── is-svg@1.1.1
│ │ │ └─┬ svgo@0.6.2
│ │ │   ├─┬ coa@1.0.1
│ │ │   │ └── q@1.4.1
│ │ │   ├── colors@1.1.2
│ │ │   ├─┬ csso@1.6.4
│ │ │   │ └── clap@1.0.10
│ │ │   ├─┬ js-yaml@3.5.4
│ │ │   │ └─┬ argparse@1.0.6
│ │ │   │   └── sprintf-js@1.0.3
│ │ │   ├── sax@1.1.6
│ │ │   └── whet.extend@0.9.9
│ │ ├── postcss-unique-selectors@2.0.2
│ │ ├── postcss-value-parser@3.3.0
│ │ └── postcss-zindex@2.0.1
│ ├─┬ loader-utils@0.2.12
│ │ ├── big.js@3.1.3
│ │ └── json5@0.4.0
│ ├─┬ lodash.camelcase@3.0.1
│ │ └─┬ lodash._createcompounder@3.0.0
│ │   ├── lodash.deburr@3.2.0
│ │   └── lodash.words@3.2.0
│ ├── object-assign@4.0.1
│ ├─┬ postcss@5.0.19
│ │ ├── js-base64@2.1.9
│ │ └── source-map@0.5.3
│ ├── postcss-modules-extract-imports@1.0.0
│ ├── postcss-modules-local-by-default@1.0.1
│ ├── postcss-modules-scope@1.0.0
│ ├─┬ postcss-modules-values@1.1.1
│ │ └── icss-replace-symbols@1.0.2
│ └── source-list-map@0.1.5
├── file-loader@0.8.5
├── font-awesome@4.5.0
├─┬ gulp@3.9.1
│ ├── archy@1.0.0
│ ├─┬ chalk@1.1.1
│ │ ├─┬ ansi-styles@2.2.0
│ │ │ └── color-convert@1.0.0
│ │ ├── escape-string-regexp@1.0.5
│ │ ├── has-ansi@2.0.0
│ │ └── supports-color@2.0.0
│ ├── deprecated@0.0.1
│ ├── interpret@1.0.0
│ ├─┬ liftoff@2.2.0
│ │ ├── extend@2.0.1
│ │ ├─┬ findup-sync@0.3.0
│ │ │ └─┬ glob@5.0.15
│ │ │   ├── inflight@1.0.4
│ │ │   └── minimatch@3.0.0
│ │ ├── flagged-respawn@0.3.1
│ │ ├── rechoir@0.6.2
│ │ └── resolve@1.1.7
│ ├── minimist@1.2.0
│ ├─┬ orchestrator@0.3.7
│ │ ├─┬ end-of-stream@0.1.5
│ │ │ └─┬ once@1.3.3
│ │ │   └── wrappy@1.0.1
│ │ ├── sequencify@0.0.7
│ │ └── stream-consume@0.1.0
│ ├── pretty-hrtime@1.0.2
│ ├── semver@4.3.6
│ ├─┬ tildify@1.1.2
│ │ └── os-homedir@1.0.1
│ ├─┬ v8flags@2.0.11
│ │ └── user-home@1.1.1
│ └─┬ vinyl-fs@0.3.14
│   ├── defaults@1.0.3
│   ├─┬ glob-stream@3.1.18
│   │ ├── glob@4.5.3
│   │ ├─┬ glob2base@0.0.12
│   │ │ └── find-index@0.1.1
│   │ ├─┬ minimatch@2.0.10
│   │ │ └─┬ brace-expansion@1.1.3
│   │ │   ├── balanced-match@0.3.0
│   │ │   └── concat-map@0.0.1
│   │ ├── ordered-read-streams@0.1.0
│   │ ├─┬ through2@0.6.5
│   │ │ └── readable-stream@1.0.33
│   │ └── unique-stream@1.0.0
│   ├─┬ glob-watcher@0.0.6
│   │ └─┬ gaze@0.5.2
│   │   └─┬ globule@0.1.0
│   │     ├─┬ glob@3.1.21
│   │     │ ├── graceful-fs@1.2.3
│   │     │ └── inherits@1.0.2
│   │     ├── lodash@1.0.2
│   │     └─┬ minimatch@0.2.14
│   │       ├── lru-cache@2.7.3
│   │       └── sigmund@1.0.1
│   ├── graceful-fs@3.0.8
│   ├─┬ strip-bom@1.0.0
│   │ ├── first-chunk-stream@1.0.0
│   │ └── is-utf8@0.2.1
│   ├─┬ through2@0.6.5
│   │ └── readable-stream@1.0.33
│   └─┬ vinyl@0.4.6
│     └── clone@0.2.0
├─┬ gulp-util@3.0.7
│ ├── array-differ@1.0.0
│ ├── array-uniq@1.0.2
│ ├── beeper@1.1.0
│ ├─┬ dateformat@1.0.12
│ │ ├── get-stdin@4.0.1
│ │ └─┬ meow@3.7.0
│ │   ├─┬ camelcase-keys@2.1.0
│ │   │ └── camelcase@2.1.1
│ │   ├─┬ loud-rejection@1.3.0
│ │   │ ├── array-find-index@1.0.1
│ │   │ └── signal-exit@2.1.2
│ │   ├── map-obj@1.0.1
│ │   ├── minimist@1.2.0
│ │   ├─┬ normalize-package-data@2.3.5
│ │   │ ├── hosted-git-info@2.1.4
│ │   │ ├─┬ is-builtin-module@1.0.0
│ │   │ │ └── builtin-modules@1.1.1
│ │   │ └─┬ validate-npm-package-license@3.0.1
│ │   │   ├─┬ spdx-correct@1.0.2
│ │   │   │ └── spdx-license-ids@1.2.0
│ │   │   └─┬ spdx-expression-parse@1.0.2
│ │   │     └── spdx-exceptions@1.0.4
│ │   ├─┬ read-pkg-up@1.0.1
│ │   │ ├─┬ find-up@1.1.2
│ │   │ │ ├── path-exists@2.1.0
│ │   │ │ └─┬ pinkie-promise@2.0.0
│ │   │ │   └── pinkie@2.0.4
│ │   │ └─┬ read-pkg@1.1.0
│ │   │   ├─┬ load-json-file@1.1.0
│ │   │   │ ├─┬ parse-json@2.2.0
│ │   │   │ │ └─┬ error-ex@1.3.0
│ │   │   │ │   └── is-arrayish@0.2.1
│ │   │   │ ├── pify@2.3.0
│ │   │   │ └── strip-bom@2.0.0
│ │   │   └── path-type@1.1.0
│ │   ├─┬ redent@1.0.0
│ │   │ ├─┬ indent-string@2.1.0
│ │   │ │ └─┬ repeating@2.0.0
│ │   │ │   └─┬ is-finite@1.0.1
│ │   │ │     └── number-is-nan@1.0.0
│ │   │ └── strip-indent@1.0.1
│ │   └── trim-newlines@1.0.0
│ ├─┬ fancy-log@1.2.0
│ │ └── time-stamp@1.0.0
│ ├─┬ gulplog@1.0.0
│ │ └── glogg@1.0.0
│ ├─┬ has-gulplog@0.1.0
│ │ └── sparkles@1.0.0
│ ├── lodash._reescape@3.0.0
│ ├── lodash._reevaluate@3.0.0
│ ├── lodash._reinterpolate@3.0.0
│ ├─┬ lodash.template@3.6.2
│ │ ├── lodash._basecopy@3.0.1
│ │ ├── lodash._basetostring@3.0.1
│ │ ├── lodash._basevalues@3.0.0
│ │ ├── lodash._isiterateecall@3.0.9
│ │ ├─┬ lodash.escape@3.2.0
│ │ │ └── lodash._root@3.0.1
│ │ ├─┬ lodash.keys@3.1.2
│ │ │ ├── lodash._getnative@3.9.1
│ │ │ ├── lodash.isarguments@3.0.8
│ │ │ └── lodash.isarray@3.0.4
│ │ ├── lodash.restparam@3.6.1
│ │ └── lodash.templatesettings@3.1.1
│ ├── minimist@1.2.0
│ ├─┬ multipipe@0.1.2
│ │ └── duplexer2@0.0.2
│ ├── object-assign@3.0.0
│ ├── replace-ext@0.0.1
│ ├─┬ through2@2.0.1
│ │ ├─┬ readable-stream@2.0.6
│ │ │ ├── core-util-is@1.0.2
│ │ │ ├── isarray@1.0.0
│ │ │ ├── process-nextick-args@1.0.6
│ │ │ └── util-deprecate@1.0.2
│ │ └── xtend@4.0.1
│ └─┬ vinyl@0.5.3
│   └── clone-stats@0.0.1
├─┬ html-webpack-plugin@2.10.0
│ ├── bluebird@3.3.4
│ ├─┬ html-minifier@1.2.0
│ │ ├─┬ change-case@2.3.1
│ │ │ ├── camel-case@1.2.2
│ │ │ ├── constant-case@1.1.2
│ │ │ ├── dot-case@1.1.2
│ │ │ ├── is-lower-case@1.1.3
│ │ │ ├── is-upper-case@1.1.2
│ │ │ ├── lower-case@1.1.3
│ │ │ ├── lower-case-first@1.0.2
│ │ │ ├── param-case@1.1.2
│ │ │ ├── pascal-case@1.1.2
│ │ │ ├── path-case@1.1.2
│ │ │ ├── sentence-case@1.1.3
│ │ │ ├── snake-case@1.1.2
│ │ │ ├── swap-case@1.1.2
│ │ │ ├── title-case@1.1.2
│ │ │ ├── upper-case@1.1.3
│ │ │ └── upper-case-first@1.1.2
│ │ ├─┬ clean-css@3.4.10
│ │ │ ├─┬ commander@2.8.1
│ │ │ │ └── graceful-readlink@1.0.1
│ │ │ └── source-map@0.4.4
│ │ ├─┬ cli@0.11.2
│ │ │ └── exit@0.1.2
│ │ ├─┬ concat-stream@1.5.1
│ │ │ ├─┬ readable-stream@2.0.6
│ │ │ │ └── isarray@1.0.0
│ │ │ └── typedarray@0.0.6
│ │ └── relateurl@0.2.6
│ ├── lodash@4.6.1
│ ├─┬ pretty-error@2.0.0
│ │ ├─┬ renderkid@2.0.0
│ │ │ ├─┬ css-select@1.2.0
│ │ │ │ ├── boolbase@1.0.0
│ │ │ │ ├── css-what@2.1.0
│ │ │ │ ├─┬ domutils@1.5.1
│ │ │ │ │ └─┬ dom-serializer@0.1.0
│ │ │ │ │   ├── domelementtype@1.1.3
│ │ │ │ │   └── entities@1.1.1
│ │ │ │ └── nth-check@1.0.1
│ │ │ ├─┬ dom-converter@0.1.4
│ │ │ │ └── utila@0.3.3
│ │ │ ├─┬ htmlparser2@3.3.0
│ │ │ │ ├── domelementtype@1.3.0
│ │ │ │ ├── domhandler@2.1.0
│ │ │ │ ├── domutils@1.1.6
│ │ │ │ └── readable-stream@1.0.33
│ │ │ └── utila@0.3.3
│ │ └── utila@0.4.0
│ └── toposort@0.2.12
├── jquery@2.2.1
├── style-loader@0.13.0
├── summernote@0.8.1
├─┬ url-loader@0.5.7
│ └── mime@1.2.11
├─┬ webpack@1.12.14
│ ├── async@1.5.2
│ ├── clone@1.0.2
│ ├─┬ enhanced-resolve@0.9.1
│ │ ├── graceful-fs@4.1.3
│ │ └── memory-fs@0.2.0
│ ├── esprima@2.7.2
│ ├── interpret@0.6.6
│ ├─┬ memory-fs@0.3.0
│ │ ├─┬ errno@0.1.4
│ │ │ └── prr@0.0.0
│ │ └─┬ readable-stream@2.0.6
│ │   └── isarray@1.0.0
│ ├─┬ mkdirp@0.5.1
│ │ └── minimist@0.0.8
│ ├─┬ node-libs-browser@0.5.3
│ │ ├── assert@1.3.0
│ │ ├─┬ browserify-zlib@0.1.4
│ │ │ └── pako@0.2.8
│ │ ├─┬ buffer@3.6.0
│ │ │ ├── base64-js@0.0.8
│ │ │ ├── ieee754@1.1.6
│ │ │ └── isarray@1.0.0
│ │ ├─┬ console-browserify@1.1.0
│ │ │ └── date-now@0.1.4
│ │ ├── constants-browserify@0.0.1
│ │ ├─┬ crypto-browserify@3.2.8
│ │ │ ├── pbkdf2-compat@2.0.1
│ │ │ ├── ripemd160@0.2.0
│ │ │ └── sha.js@2.2.6
│ │ ├── domain-browser@1.1.7
│ │ ├── events@1.1.0
│ │ ├─┬ http-browserify@1.7.0
│ │ │ └── Base64@0.2.1
│ │ ├── https-browserify@0.0.0
│ │ ├── os-browserify@0.1.2
│ │ ├── path-browserify@0.0.0
│ │ ├── process@0.11.2
│ │ ├── punycode@1.4.0
│ │ ├── querystring-es3@0.2.1
│ │ ├─┬ readable-stream@1.1.13
│ │ │ └── isarray@0.0.1
│ │ ├── stream-browserify@1.0.0
│ │ ├── string_decoder@0.10.31
│ │ ├── timers-browserify@1.4.2
│ │ ├── tty-browserify@0.0.0
│ │ ├─┬ url@0.10.3
│ │ │ ├── punycode@1.3.2
│ │ │ └── querystring@0.2.0
│ │ ├── util@0.10.3
│ │ └─┬ vm-browserify@0.0.4
│ │   └── indexof@0.0.1
│ ├─┬ optimist@0.6.1
│ │ └── wordwrap@0.0.2
│ ├─┬ supports-color@3.1.2
│ │ └── has-flag@1.0.0
│ ├── tapable@0.1.10
│ ├─┬ uglify-js@2.6.2
│ │ ├── async@0.2.10
│ │ ├── uglify-to-browserify@1.0.2
│ │ └─┬ yargs@3.10.0
│ │   ├── camelcase@1.2.1
│ │   ├─┬ cliui@2.1.0
│ │   │ ├─┬ center-align@0.1.3
│ │   │ │ ├─┬ align-text@0.1.4
│ │   │ │ │ ├── longest@1.0.1
│ │   │ │ │ └── repeat-string@1.5.4
│ │   │ │ └── lazy-cache@1.0.3
│ │   │ └── right-align@0.1.3
│ │   └── window-size@0.1.0
│ ├─┬ watchpack@0.2.9
│ │ ├── async@0.9.2
│ │ └─┬ chokidar@1.4.3
│ │   ├─┬ anymatch@1.3.0
│ │   │ ├── arrify@1.0.1
│ │   │ └─┬ micromatch@2.3.7
│ │   │   ├─┬ arr-diff@2.0.0
│ │   │   │ └── arr-flatten@1.0.1
│ │   │   ├── array-unique@0.2.1
│ │   │   ├─┬ braces@1.8.3
│ │   │   │ ├─┬ expand-range@1.8.1
│ │   │   │ │ └─┬ fill-range@2.2.3
│ │   │   │ │   ├── is-number@2.1.0
│ │   │   │ │   ├── isobject@2.0.0
│ │   │   │ │   └── randomatic@1.1.5
│ │   │   │ ├── preserve@0.2.0
│ │   │   │ └── repeat-element@1.1.2
│ │   │   ├── expand-brackets@0.1.4
│ │   │   ├── extglob@0.3.2
│ │   │   ├── filename-regex@2.0.0
│ │   │   ├─┬ kind-of@3.0.2
│ │   │   │ └── is-buffer@1.1.3
│ │   │   ├── normalize-path@2.0.1
│ │   │   ├─┬ object.omit@2.0.0
│ │   │   │ ├─┬ for-own@0.1.3
│ │   │   │ │ └── for-in@0.1.4
│ │   │   │ └── is-extendable@0.1.1
│ │   │   ├─┬ parse-glob@3.0.4
│ │   │   │ ├── glob-base@0.3.0
│ │   │   │ └── is-dotfile@1.0.2
│ │   │   └─┬ regex-cache@0.4.2
│ │   │     ├── is-equal-shallow@0.1.3
│ │   │     └── is-primitive@2.0.0
│ │   ├── async-each@1.0.0
│ │   ├─┬ fsevents@1.0.8
│ │   │ ├── nan@2.2.0
│ │   │ └─┬ node-pre-gyp@0.6.21
│ │   │   ├─┬ mkdirp@0.5.1
│ │   │   │ └── minimist@0.0.8
│ │   │   ├─┬ nopt@3.0.6
│ │   │   │ └── abbrev@1.0.7
│ │   │   ├─┬ npmlog@2.0.2
│ │   │   │ ├── ansi@0.3.1
│ │   │   │ ├─┬ are-we-there-yet@1.0.6
│ │   │   │ │ └── delegates@1.0.0
│ │   │   │ └─┬ gauge@1.2.5
│ │   │   │   ├── has-unicode@2.0.0
│ │   │   │   ├─┬ lodash.pad@3.3.0
│ │   │   │   │ ├── lodash._root@3.0.0
│ │   │   │   │ └── lodash.repeat@3.2.0
│ │   │   │   ├─┬ lodash.padleft@3.1.1
│ │   │   │   │ ├── lodash._basetostring@3.0.1
│ │   │   │   │ └── lodash._createpadding@3.6.1
│ │   │   │   └── lodash.padright@3.1.1
│ │   │   ├─┬ rc@1.1.6
│ │   │   │ ├── deep-extend@0.4.1
│ │   │   │ ├── ini@1.3.4
│ │   │   │ ├── minimist@1.2.0
│ │   │   │ └── strip-json-comments@1.0.4
│ │   │   ├─┬ request@2.69.0
│ │   │   │ ├── aws-sign2@0.6.0
│ │   │   │ ├─┬ aws4@1.2.1
│ │   │   │ │ └── lru-cache@2.7.3
│ │   │   │ ├── bl@1.0.2
│ │   │   │ ├── caseless@0.11.0
│ │   │   │ ├─┬ combined-stream@1.0.5
│ │   │   │ │ └── delayed-stream@1.0.0
│ │   │   │ ├── extend@3.0.0
│ │   │   │ ├── forever-agent@0.6.1
│ │   │   │ ├─┬ form-data@1.0.0-rc3
│ │   │   │ │ └── async@1.5.2
│ │   │   │ ├─┬ har-validator@2.0.6
│ │   │   │ │ ├─┬ chalk@1.1.1
│ │   │   │ │ │ ├── ansi-styles@2.1.0
│ │   │   │ │ │ ├── escape-string-regexp@1.0.4
│ │   │   │ │ │ ├─┬ has-ansi@2.0.0
│ │   │   │ │ │ │ └── ansi-regex@2.0.0
│ │   │   │ │ │ ├── strip-ansi@3.0.0
│ │   │   │ │ │ └── supports-color@2.0.0
│ │   │   │ │ ├─┬ commander@2.9.0
│ │   │   │ │ │ └── graceful-readlink@1.0.1
│ │   │   │ │ ├─┬ is-my-json-valid@2.12.4
│ │   │   │ │ │ ├── generate-function@2.0.0
│ │   │   │ │ │ ├─┬ generate-object-property@1.2.0
│ │   │   │ │ │ │ └── is-property@1.0.2
│ │   │   │ │ │ ├── jsonpointer@2.0.0
│ │   │   │ │ │ └── xtend@4.0.1
│ │   │   │ │ └─┬ pinkie-promise@2.0.0
│ │   │   │ │   └── pinkie@2.0.4
│ │   │   │ ├─┬ hawk@3.1.3
│ │   │   │ │ ├── boom@2.10.1
│ │   │   │ │ ├── cryptiles@2.0.5
│ │   │   │ │ ├── hoek@2.16.3
│ │   │   │ │ └── sntp@1.0.9
│ │   │   │ ├─┬ http-signature@1.1.1
│ │   │   │ │ ├── assert-plus@0.2.0
│ │   │   │ │ ├─┬ jsprim@1.2.2
│ │   │   │ │ │ ├── extsprintf@1.0.2
│ │   │   │ │ │ ├── json-schema@0.2.2
│ │   │   │ │ │ └── verror@1.3.6
│ │   │   │ │ └─┬ sshpk@1.7.3
│ │   │   │ │   ├── asn1@0.2.3
│ │   │   │ │   ├── dashdash@1.12.2
│ │   │   │ │   ├── ecc-jsbn@0.1.1
│ │   │   │ │   ├── jodid25519@1.0.2
│ │   │   │ │   ├── jsbn@0.1.0
│ │   │   │ │   └── tweetnacl@0.13.3
│ │   │   │ ├── is-typedarray@1.0.0
│ │   │   │ ├── isstream@0.1.2
│ │   │   │ ├── json-stringify-safe@5.0.1
│ │   │   │ ├─┬ mime-types@2.1.9
│ │   │   │ │ └── mime-db@1.21.0
│ │   │   │ ├── node-uuid@1.4.7
│ │   │   │ ├── oauth-sign@0.8.1
│ │   │   │ ├── qs@6.0.2
│ │   │   │ ├── stringstream@0.0.5
│ │   │   │ ├── tough-cookie@2.2.1
│ │   │   │ └── tunnel-agent@0.4.2
│ │   │   ├─┬ rimraf@2.5.1
│ │   │   │ └─┬ glob@6.0.4
│ │   │   │   ├─┬ inflight@1.0.4
│ │   │   │   │ └── wrappy@1.0.1
│ │   │   │   ├── inherits@2.0.1
│ │   │   │   ├─┬ minimatch@3.0.0
│ │   │   │   │ └─┬ brace-expansion@1.1.2
│ │   │   │   │   ├── balanced-match@0.3.0
│ │   │   │   │   └── concat-map@0.0.1
│ │   │   │   ├─┬ once@1.3.3
│ │   │   │   │ └── wrappy@1.0.1
│ │   │   │   └── path-is-absolute@1.0.0
│ │   │   ├── semver@5.1.0
│ │   │   ├─┬ tar@2.2.1
│ │   │   │ ├── block-stream@0.0.8
│ │   │   │ ├─┬ fstream@1.0.8
│ │   │   │ │ └── graceful-fs@4.1.3
│ │   │   │ └── inherits@2.0.1
│ │   │   └─┬ tar-pack@3.1.3
│ │   │     ├─┬ debug@2.2.0
│ │   │     │ └── ms@0.7.1
│ │   │     ├─┬ fstream-ignore@1.0.3
│ │   │     │ └─┬ minimatch@3.0.0
│ │   │     │   └─┬ brace-expansion@1.1.2
│ │   │     │     ├── balanced-match@0.3.0
│ │   │     │     └── concat-map@0.0.1
│ │   │     ├─┬ once@1.3.3
│ │   │     │ └── wrappy@1.0.1
│ │   │     ├─┬ readable-stream@2.0.5
│ │   │     │ ├── core-util-is@1.0.2
│ │   │     │ ├── isarray@0.0.1
│ │   │     │ ├── process-nextick-args@1.0.6
│ │   │     │ ├── string_decoder@0.10.31
│ │   │     │ └── util-deprecate@1.0.2
│ │   │     └── uid-number@0.0.6
│ │   ├── glob-parent@2.0.0
│ │   ├─┬ is-binary-path@1.0.1
│ │   │ └── binary-extensions@1.4.0
│ │   ├─┬ is-glob@2.0.1
│ │   │ └── is-extglob@1.0.0
│ │   ├── path-is-absolute@1.0.0
│ │   └─┬ readdirp@2.0.0
│ │     ├── minimatch@2.0.10
│ │     └─┬ readable-stream@2.0.6
│ │       └── isarray@1.0.0
│ └─┬ webpack-core@0.6.8
│   └─┬ source-map@0.4.4
│     └── amdefine@1.0.0
└─┬ webpack-dev-server@1.14.1
  ├─┬ compression@1.6.1
  │ ├─┬ accepts@1.3.2
  │ │ └── negotiator@0.6.0
  │ ├── bytes@2.2.0
  │ ├─┬ compressible@2.0.7
  │ │ └── mime-db@1.22.0
  │ ├─┬ debug@2.2.0
  │ │ └── ms@0.7.1
  │ ├── on-headers@1.0.1
  │ └── vary@1.1.0
  ├── connect-history-api-fallback@1.1.0
  ├─┬ express@4.13.4
  │ ├─┬ accepts@1.2.13
  │ │ └── negotiator@0.5.3
  │ ├── array-flatten@1.1.1
  │ ├── content-disposition@0.5.1
  │ ├── content-type@1.0.1
  │ ├── cookie@0.1.5
  │ ├── cookie-signature@1.0.6
  │ ├── depd@1.1.0
  │ ├── escape-html@1.0.3
  │ ├── etag@1.7.0
  │ ├─┬ finalhandler@0.4.1
  │ │ └── unpipe@1.0.0
  │ ├── fresh@0.3.0
  │ ├── merge-descriptors@1.0.1
  │ ├── methods@1.1.2
  │ ├─┬ on-finished@2.3.0
  │ │ └── ee-first@1.1.1
  │ ├── parseurl@1.3.1
  │ ├── path-to-regexp@0.1.7
  │ ├─┬ proxy-addr@1.0.10
  │ │ ├── forwarded@0.1.0
  │ │ └── ipaddr.js@1.0.5
  │ ├── qs@4.0.0
  │ ├── range-parser@1.0.3
  │ ├─┬ send@0.13.1
  │ │ ├── destroy@1.0.4
  │ │ ├── mime@1.3.4
  │ │ └── statuses@1.2.1
  │ ├── serve-static@1.10.2
  │ ├─┬ type-is@1.6.12
  │ │ └── media-typer@0.3.0
  │ ├── utils-merge@1.0.0
  │ └── vary@1.0.1
  ├─┬ http-proxy@1.13.2
  │ ├── eventemitter3@1.1.1
  │ └── requires-port@1.0.0
  ├─┬ serve-index@1.7.3
  │ ├─┬ accepts@1.2.13
  │ │ └── negotiator@0.5.3
  │ ├── batch@0.5.3
  │ ├── http-errors@1.3.1
  │ └── mime-types@2.1.10
  ├─┬ sockjs@0.3.15
  │ ├─┬ faye-websocket@0.9.4
  │ │ └─┬ websocket-driver@0.6.4
  │ │   └── websocket-extensions@0.1.1
  │ └── node-uuid@1.4.7
  ├─┬ sockjs-client@1.0.3
  │ ├─┬ eventsource@0.1.6
  │ │ └── original@1.0.0
  │ ├── faye-websocket@0.7.3
  │ ├── inherits@2.0.1
  │ ├── json3@3.3.2
  │ └─┬ url-parse@1.0.5
  │   └── querystringify@0.0.3
  ├── stream-cache@0.0.2
  ├─┬ strip-ansi@3.0.1
  │ └── ansi-regex@2.0.0
  └─┬ webpack-dev-middleware@1.5.1
    └── mime@1.3.4

2016-03-16 6 16 30

2016-03-16 6 16 38

@apocalyarts

This comment has been minimized.

Copy link

commented Nov 10, 2016

same problem here

@mathieumg

This comment has been minimized.

Copy link
Contributor Author

commented Nov 10, 2016

@item4 You need Summernote 0.8.2 or more. You have summernote@0.8.1 installed.

@apocalyarts

This comment has been minimized.

Copy link

commented Nov 10, 2016

@mathieumg I have the same problem as @item4 and I am using summernote 0.8.2 with webpack.

@bonk

This comment has been minimized.

Copy link

commented Jan 5, 2017

How about this?

require('codemirror/lib/codemirror.css');

@graingert

This comment has been minimized.

Copy link
Contributor

commented Jan 5, 2017

@bonk That just loads the codemirror css...

@bonk

This comment has been minimized.

Copy link

commented Jan 5, 2017

That's right. I got summernote-webpack-example and added the css part. I think that I was wrong with the contents of the issue. I'm sorry.

@aguynamedben

This comment has been minimized.

Copy link

commented Nov 16, 2017

What worked for me in summernote 0.8.8, in my webpack config...

const webpack = require('webpack');

const config = {
  // ... rest of webpack config
  plugins: [
    new webpack.IgnorePlugin(/^codemirror$/),
  ],
}

I believe this forces the require.resolve('codemirror'); in ./node_modules/summernote/dist/summernote.js to fail, and I guess summernotes doesn't need CodeMirror to operate.

@gustavorglima

This comment has been minimized.

Copy link

commented Apr 30, 2018

On Laravel:

webpack.mix.js

let webpack = require('webpack');

mix.webpackConfig({
    plugins: [
        new webpack.IgnorePlugin(/^codemirror$/)
    ]
});
@shane-smith

This comment has been minimized.

Copy link

commented May 21, 2018

Thanks @gustavorglima - that was the key!

@radonirinamaminiaina

This comment has been minimized.

Copy link

commented Jun 6, 2018

@aguynamedben

Thanx for your solution, it works for me!

@ryancwalsh

This comment has been minimized.

Copy link

commented Jan 24, 2019

@gustavorglima Thank you! That worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.