webpack-require-http webpack encore symfony - требуется внешний js - PullRequest
0 голосов
/ 29 ноября 2018

Я пытался добавить это расширение:

https://www.npmjs.com/package/webpack-require-http

на бис веб-пакета:

.addExternals({
          'webpack-require-http'  :require('webpack-require-http')
    })

но я получил:

encore dev --watch
Running webpack ...

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.externals should be one of these:
   string | object { <key>: string | object | boolean } | function | RegExp | [string | object { <key>: string | object | boolean } | function | RegExp | [(recursive)]]
   -> Specify dependencies that shouldn't be resolved by webpack, but should become dependencies of the resulting bundle. The kind of the dependency depends on `output.libraryTarget`.
   Details:
    * configuration.externals should be a string.
      -> An exact matched dependency becomes external. The same string is used as external dependency.
    * configuration.externals['webpack-require-http'] should be a string.
    * configuration.externals['webpack-require-http'] should be an object.
    * configuration.externals['webpack-require-http'] should be a boolean.
    * configuration.externals should be an instance of function
      -> `function(context, request, callback(err, result))` The function is called on each dependency.
    * configuration.externals should be an instance of RegExp
      -> Every matched dependency becomes external.
    * configuration.externals should be an array:
      [string | object { <key>: string | object | boolean } | function | RegExp | [(recursive)]]
error Command failed with exit code 1.

Я хочу загрузить сгенерированный php js в веб-пакет.

В vendor.js добавьте:

require('http://10.2.0.2/vars.js');

Этот URL-файл сгенерирован php js.

...