numical / script-ext-html-webpack-plugin

Enhances html-webpack-plugin functionality with different deployment options for your scripts including 'async', 'preload', 'prefetch', 'defer', 'module', custom attributes, and inlining.
MIT License
588 stars 105 forks source link

TypeError: patterns.some is not a function #30

Closed splincode closed 7 years ago

splincode commented 7 years ago

webpack.common.js


let plugins = [
new ScriptExtHtmlWebpackPlugin({
            sync: /polyfill|vendor/,
            defaultAttribute: 'async',
            preload: [/polyfill|vendor|main/],
            prefetch: [/chunk/]
        }),
];

ERROR in   TypeError: patterns.some is not a function

  - index.js:44 matches
    [ui-util]/[script-ext-html-webpack-plugin]/index.js:44:19

  - index.js:60 ATTRIBUTE_PRIORITIES.forEach
    [ui-util]/[script-ext-html-webpack-plugin]/index.js:60:38

  - Array.forEach

  - index.js:59 generateSrcScriptElement
    [ui-util]/[script-ext-html-webpack-plugin]/index.js:59:24

  - index.js:37 htmlPluginData.html.htmlPluginData.html.replace
    [ui-util]/[script-ext-html-webpack-plugin]/index.js:37:14

  - String.replace

  - index.js:32 replaceScriptElements
    [ui-util]/[script-ext-html-webpack-plugin]/index.js:32:45

  - index.js:88 Compilation.compilation.plugin
    [ui-util]/[script-ext-html-webpack-plugin]/index.js:88:11

  - Tapable.js:208 Compilation.applyPluginsAsyncWaterfall
    [ui-util]/[tapable]/lib/Tapable.js:208:13

  - util.js:16 Compilation.tryCatcher
    [ui-util]/[bluebird]/js/release/util.js:16:23

  - index.js:159 
    [ui-util]/[html-webpack-plugin]/index.js:159:16

  - util.js:16 tryCatcher
    [ui-util]/[bluebird]/js/release/util.js:16:23

  - promise.js:512 Promise._settlePromiseFromHandler
    [ui-util]/[bluebird]/js/release/promise.js:512:31

  - promise.js:569 Promise._settlePromise
    [ui-util]/[bluebird]/js/release/promise.js:569:18

  - promise.js:614 Promise._settlePromise0
    [ui-util]/[bluebird]/js/release/promise.js:614:10

  - promise.js:693 Promise._settlePromises
    [ui-util]/[bluebird]/js/release/promise.js:693:18

  - async.js:133 Async._drainQueue
    [ui-util]/[bluebird]/js/release/async.js:133:16

  - async.js:143 Async._drainQueues
    [ui-util]/[bluebird]/js/release/async.js:143:10

  - async.js:17 Immediate.Async.drainQueues
    [ui-util]/[bluebird]/js/release/async.js:17:14
numical commented 7 years ago

Hiya, Should your regex expressions be wrapped with slashes rather than square brackets? ie:

            preload: /polyfill|vendor|main/,
            prefetch: /chunk/