config.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /* eslint-disable max-len */
  2. const fs = require('fs');
  3. const PACKAGE_NAME = require('../package.json').name;
  4. module.exports = {
  5. PACKAGE_NAME,
  6. NAMESPACE: fs.realpathSync(__dirname),
  7. EXTRACTABLE_MODULE_ISSUER_PATTERN: /\.(css|sass|scss|less|styl|html)$/i,
  8. SPRITE_PLACEHOLDER_PATTERN: /\{\{sprite-filename\|([^}}]*)\}\};?/gi,
  9. /**
  10. * Overridable loader options
  11. * @typedef {Object} SVGSpriteLoaderConfig
  12. */
  13. loader: {
  14. /**
  15. * How `<symbol id>` should be named.
  16. * Full list of supported patterns see at [loader-utils#interpolatename docs](https://github.com/webpack/loader-utils#interpolatename).
  17. * @type {string}
  18. */
  19. symbolId: '[name]',
  20. /**
  21. * Path to Node.js module which generates client runtime.
  22. * @type {string}
  23. */
  24. runtimeGenerator: require.resolve('./runtime-generator'),
  25. /**
  26. * Arbitrary data passed to runtime generator.
  27. * @type {*}
  28. */
  29. runtimeOptions: undefined,
  30. /**
  31. * Should runtime be compatible with earlier v0.* loader versions.
  32. * Will be removed in 3 version.
  33. * @type {boolean}
  34. * @deprecated
  35. */
  36. runtimeCompat: false,
  37. /**
  38. * Path to sprite module which will be compiled and executed at runtime.
  39. * By default depends on 'target' webpack config option:
  40. * - `svg-sprite-loader/runtime/browser-sprite.build` for 'web' target.
  41. * - `svg-sprite-loader/runtime/sprite.build` for all other targets.
  42. * @type {string}
  43. * @autoconfigured
  44. */
  45. spriteModule: 'svg-sprite-loader/runtime/browser-sprite.build',
  46. /**
  47. * Path to symbol module.
  48. * By default depends on 'target' webpack config option:
  49. * - `svg-baker-runtime/browser-symbol` for 'web' target.
  50. * - `svg-baker-runtime/symbol` for all other targets.
  51. * @type {string}
  52. * @autoconfigured
  53. */
  54. symbolModule: 'svg-baker-runtime/browser-symbol',
  55. /**
  56. * Generated export format:
  57. * - when `true` loader will produce `export default ...`.
  58. * - when `false` the result is `module.exports = ...`.
  59. * By default depends on used webpack version. `true` for Webpack >= 2, `false` otherwise.
  60. * @type {boolean}
  61. * @autoconfigured
  62. */
  63. esModule: true,
  64. /**
  65. * Turns loader in extract mode.
  66. * Enables automatically if SVG image was imported from css/scss/sass/less/styl/html.
  67. * @type {boolean}
  68. * @autoconfigured
  69. */
  70. extract: false,
  71. /**
  72. * Filename for generated sprite. `[chunkname]` placeholder can be used.
  73. * @type {string}
  74. */
  75. spriteFilename: 'sprite.svg'
  76. }
  77. };