Summernote v0.8.1 breaks webpack builds. #1

Closed
samkelleher opened this Issue Feb 21, 2016 · 6 comments

Projects

None yet

3 participants

@samkelleher

Run this exact code but running 0.8.1 instead of 0.7.3 and webpack can no longer build.

Webpack is adding a [30] ./~/summernote/dist ^\.\/.*$ 4.93 kB {0} [built] [1 warning] chunk which then pulls in every file in the dist folder (including languages, and other non-js content like fonts, zip files).

These files cause errors. Perhaps this issue is better raised within summernote project itself (summernote/summernote#1703).

ERROR in ./~/summernote/dist/font/summernote.eot?ad8d7e2d177d2473aecd9b35d16211fb
Module parse failed: /Users/Sam/Repositories/summernote-webpack-example/node_modules/summernote/dist/font/summernote.eot?ad8d7e2d177d2473aecd9b35d16211fb Line 1: Unexpected token ILLEGAL
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
 @ ./~/css-loader!./~/summernote/dist/summernote.css 6:113-178
@hackerwins
Member

@samkelleher Thanks for reporting. Please refer to below commit.
36e15e2

@samkelleher

@hackerwins Thanks for the amends, but the issue still exists. The build still errors complaining that it can't interpret files, such as the zip, regardless of that, it still imports all the other dist files:

What is inside the summernote script that is causing webpack to interpret all these files as dependencies? I can't spot a ./.* require call anywhere.

 [30] ./~/summernote/dist ^\.\/.*$ 4.93 kB {0} [built] [1 warning]
   [31] ./~/summernote/dist/font/summernote.ttf 17.5 kB {0} [optional] [built]
   [32] ./~/summernote/dist/font/summernote.woff 11.2 kB {0} [optional] [built]
   [33] ./~/summernote/dist/lang/summernote-ar-AR.js 2.63 kB {0} [optional] [built]
   [34] ./~/summernote/dist/lang/summernote-ar-AR.min.js 1.78 kB {0} [optional] [built]
   [35] ./~/summernote/dist/lang/summernote-bg-BG.js 2.72 kB {0} [optional] [built]
   [36] ./~/summernote/dist/lang/summernote-bg-BG.min.js 1.92 kB {0} [optional] [built]
   [37] ./~/summernote/dist/lang/summernote-ca-ES.js 4.9 kB {0} [optional] [built]
   [38] ./~/summernote/dist/lang/summernote-ca-ES.min.js 3.56 kB {0} [optional] [built]
   [39] ./~/summernote/dist/lang/summernote-cs-CZ.js 2.79 kB {0} [optional] [built]
   [40] ./~/summernote/dist/lang/summernote-cs-CZ.min.js 1.96 kB {0} [optional] [built]
   [41] ./~/summernote/dist/lang/summernote-da-DK.js 3.2 kB {0} [optional] [built]
   [42] ./~/summernote/dist/lang/summernote-da-DK.min.js 2.26 kB {0} [optional] [built]
   [43] ./~/summernote/dist/lang/summernote-de-DE.js 3.14 kB {0} [optional] [built]
   [44] ./~/summernote/dist/lang/summernote-de-DE.min.js 2.24 kB {0} [optional] [built]
   [45] ./~/summernote/dist/lang/summernote-es-ES.js 4.9 kB {0} [optional] [built]
   [46] ./~/summernote/dist/lang/summernote-es-ES.min.js 3.58 kB {0} [optional] [built]
   [47] ./~/summernote/dist/lang/summernote-es-EU.js 2.96 kB {0} [optional] [built]
   [48] ./~/summernote/dist/lang/summernote-es-EU.min.js 2.08 kB {0} [optional] [built]
   [49] ./~/summernote/dist/lang/summernote-fa-IR.js 2.75 kB {0} [optional] [built]
   [50] ./~/summernote/dist/lang/summernote-fa-IR.min.js 1.9 kB {0} [optional] [built]
   [51] ./~/summernote/dist/lang/summernote-fi-FI.js 2.83 kB {0} [optional] [built]
   [52] ./~/summernote/dist/lang/summernote-fi-FI.min.js 1.98 kB {0} [optional] [built]
   [53] ./~/summernote/dist/lang/summernote-fr-FR.js 3.47 kB {0} [optional] [built]
   [54] ./~/summernote/dist/lang/summernote-fr-FR.min.js 2.51 kB {0} [optional] [built]
   [55] ./~/summernote/dist/lang/summernote-he-IL.js 2.66 kB {0} [optional] [built]
   [56] ./~/summernote/dist/lang/summernote-he-IL.min.js 1.78 kB {0} [optional] [built]
   [57] ./~/summernote/dist/lang/summernote-hu-HU.js 4.23 kB {0} [optional] [built]
   [58] ./~/summernote/dist/lang/summernote-hu-HU.min.js 3.03 kB {0} [optional] [built]
   [59] ./~/summernote/dist/lang/summernote-id-ID.js 2.7 kB {0} [optional] [built]
   [60] ./~/summernote/dist/lang/summernote-id-ID.min.js 1.86 kB {0} [optional] [built]
   [61] ./~/summernote/dist/lang/summernote-it-IT.js 3.11 kB {0} [optional] [built]
   [62] ./~/summernote/dist/lang/summernote-it-IT.min.js 2.26 kB {0} [optional] [built]
   [63] ./~/summernote/dist/lang/summernote-ja-JP.js 2.3 kB {0} [optional] [built]
   [64] ./~/summernote/dist/lang/summernote-ja-JP.min.js 1.45 kB {0} [optional] [built]
   [65] ./~/summernote/dist/lang/summernote-ko-KR.js 2.67 kB {0} [optional] [built]
   [66] ./~/summernote/dist/lang/summernote-ko-KR.min.js 1.72 kB {0} [optional] [built]
   [67] ./~/summernote/dist/lang/summernote-lt-LT.js 3.21 kB {0} [optional] [built]
   [68] ./~/summernote/dist/lang/summernote-lt-LT.min.js 2.33 kB {0} [optional] [built]
   [69] ./~/summernote/dist/lang/summernote-nb-NO.js 2.82 kB {0} [optional] [built]
   [70] ./~/summernote/dist/lang/summernote-nb-NO.min.js 1.97 kB {0} [optional] [built]
   [71] ./~/summernote/dist/lang/summernote-nl-NL.js 2.88 kB {0} [optional] [built]
   [72] ./~/summernote/dist/lang/summernote-nl-NL.min.js 2.03 kB {0} [optional] [built]
   [73] ./~/summernote/dist/lang/summernote-pl-PL.js 3.25 kB {0} [optional] [built]
   [74] ./~/summernote/dist/lang/summernote-pl-PL.min.js 2.32 kB {0} [optional] [built]
   [75] ./~/summernote/dist/lang/summernote-pt-BR.js 2.81 kB {0} [optional] [built]
   [76] ./~/summernote/dist/lang/summernote-pt-BR.min.js 1.97 kB {0} [optional] [built]
   [77] ./~/summernote/dist/lang/summernote-pt-PT.js 2.64 kB {0} [optional] [built]
   [78] ./~/summernote/dist/lang/summernote-pt-PT.min.js 1.86 kB {0} [optional] [built]
   [79] ./~/summernote/dist/lang/summernote-ro-RO.js 2.8 kB {0} [optional] [built]
   [80] ./~/summernote/dist/lang/summernote-ro-RO.min.js 1.98 kB {0} [optional] [built]
   [81] ./~/summernote/dist/lang/summernote-ru-RU.js 3.26 kB {0} [optional] [built]
   [82] ./~/summernote/dist/lang/summernote-ru-RU.min.js 2.33 kB {0} [optional] [built]
   [83] ./~/summernote/dist/lang/summernote-sk-SK.js 2.81 kB {0} [optional] [built]
   [84] ./~/summernote/dist/lang/summernote-sk-SK.min.js 1.98 kB {0} [optional] [built]
   [85] ./~/summernote/dist/lang/summernote-sl-SI.js 2.99 kB {0} [optional] [built]
   [86] ./~/summernote/dist/lang/summernote-sl-SI.min.js 2.12 kB {0} [optional] [built]
   [87] ./~/summernote/dist/lang/summernote-sr-RS.js 2.81 kB {0} [optional] [built]
   [88] ./~/summernote/dist/lang/summernote-sr-RS-Latin.js 2.82 kB {0} [optional] [built]
   [89] ./~/summernote/dist/lang/summernote-sr-RS-Latin.min.js 1.97 kB {0} [optional] [built]
   [90] ./~/summernote/dist/lang/summernote-sr-RS.min.js 1.95 kB {0} [optional] [built]
   [91] ./~/summernote/dist/lang/summernote-sv-SE.js 2.82 kB {0} [optional] [built]
   [92] ./~/summernote/dist/lang/summernote-sv-SE.min.js 1.97 kB {0} [optional] [built]
   [93] ./~/summernote/dist/lang/summernote-th-TH.js 2.5 kB {0} [optional] [built]
   [94] ./~/summernote/dist/lang/summernote-th-TH.min.js 2.01 kB {0} [optional] [built]
   [95] ./~/summernote/dist/lang/summernote-tr-TR.js 3 kB {0} [optional] [built]
   [96] ./~/summernote/dist/lang/summernote-tr-TR.min.js 2.09 kB {0} [optional] [built]
   [97] ./~/summernote/dist/lang/summernote-uk-UA.js 3.23 kB {0} [optional] [built]
   [98] ./~/summernote/dist/lang/summernote-uk-UA.min.js 2.31 kB {0} [optional] [built]
   [99] ./~/summernote/dist/lang/summernote-vi-VN.js 2.59 kB {0} [optional] [built]
  [100] ./~/summernote/dist/lang/summernote-vi-VN.min.js 1.74 kB {0} [optional] [built]
  [101] ./~/summernote/dist/lang/summernote-zh-CN.js 2.48 kB {0} [optional] [built]
  [102] ./~/summernote/dist/lang/summernote-zh-CN.min.js 1.54 kB {0} [optional] [built]
  [103] ./~/summernote/dist/lang/summernote-zh-TW.js 2.49 kB {0} [optional] [built]
  [104] ./~/summernote/dist/lang/summernote-zh-TW.min.js 1.55 kB {0} [optional] [built]
  [106] ./~/summernote/dist/summernote.min.js 88.8 kB {0} [optional] [built]
  [107] ./~/codemirror/lib/codemirror.js 353 kB {0} [built]
@Dorphern
Dorphern commented Mar 1, 2016

@hackerwins I'm having the same problem.
The following code in summernote creates multiple warnings, and also is the one responsible for requiring all the extra code @samkelleher is mentioning (line 379 - 410):

if (!hasCodeMirror && isSupportAmd && require) {
    if (require.hasOwnProperty('resolve')) {
      try {
        // If CodeMirror can't be resolved, `require.resolve` will throw an
        // exception and `hasCodeMirror` won't be set to `true`.
        require.resolve('codemirror');
        hasCodeMirror = true;
      } catch (e) {
        hasCodeMirror = false;
      }
    } else if (require.hasOwnProperty('specified')) {
      hasCodeMirror = require.specified('codemirror');
    }
  }

The require in the first line for some reason requires all the files inside the codemirror directory, including the zip files and others

@samkelleher

I still can't work out what is inside summernote that makes webpack want to install the entire directory. I can't spot the line that triggers this behaviour.

@Dorphern
Dorphern commented Mar 1, 2016

@samkelleher I found the problem, just edited my prior comment instead of making a new :)

@Dorphern
Dorphern commented Mar 1, 2016

I've created a new issue in the summernote repository summernote/summernote#1723

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment