cascornelissen / svg-spritemap-webpack-plugin

SVG spritemap plugin for webpack
MIT License
207 stars 50 forks source link

Path not valid in v3.8.0 #136

Closed markgaze closed 3 years ago

markgaze commented 3 years ago

Description

v3.8.0 throws an error about invalid paths when running the same config that is working in v3.7.1:

Expected behavior

SVG output is successful

Actual behavior

path/to/files is neither a posix nor a windows path, and there is no 'join' method defined in the file system
  at join (/Users/mark.gaze/git/company/package/node_modules/webpack/lib/util/fs.js:117:9)
  at /Users/mark.gaze/git/company/package/node_modules/webpack/lib/FileSystemInfo.js:2519:20
  at arrayEachIndex (/Users/mark.gaze/git/company/package/node_modules/neo-async/async.js:2548:9)
  at Object.map (/Users/mark.gaze/git/company/package/node_modules/neo-async/async.js:2900:9)
  at Array.<anonymous> (/Users/mark.gaze/git/company/package/node_modules/webpack/lib/FileSystemInfo.js:2516:13)
  at runCallbacks (/Users/mark.gaze/git/company/package/node_modules/webpack/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:25:15)
  at /Users/mark.gaze/git/company/package/node_modules/webpack/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:198:4
  at go$readdir$cb (/Users/mark.gaze/git/company/package/node_modules/graceful-fs/graceful-fs.js:195:14)
  at FSReqCallback.oncomplete (node:fs:179:23)

System information

npx envinfo --system --binaries --npmPackages

 System:
    OS: macOS 11.0.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 463.58 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 15.2.0 - /usr/local/bin/node
    npm: 6.14.8 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  npmPackages:
    @cypress/webpack-preprocessor: ^5.5.0 => 5.5.0
    @hkdobrev/run-if-changed: ^0.3.1 => 0.3.1
    @percy/cypress: ^2.3.3 => 2.3.3
    @storybook/addon-a11y: ^6.1.10 => 6.1.10
    @storybook/addon-actions: ^6.1.10 => 6.1.10
    @storybook/addon-backgrounds: ^6.1.10 => 6.1.10
    @storybook/addon-controls: ^6.1.10 => 6.1.10
    @storybook/addon-docs: ^6.1.10 => 6.1.10
    @storybook/addon-jest: ^6.1.10 => 6.1.10
    @storybook/addon-viewport: ^6.1.10 => 6.1.10
    @storybook/preset-typescript: ^3.0.0 => 3.0.0
    @storybook/react: ^6.1.10 => 6.1.10
    @stryker-mutator/core: ^4.2.0 => 4.2.0
    @stryker-mutator/jest-runner: ^4.2.0 => 4.2.0
    @testing-library/jest-dom: ^5.11.6 => 5.11.6
    @testing-library/react: ^11.2.2 => 11.2.2
    @types/classnames: ^2.2.11 => 2.2.11
    @types/enzyme: ^3.10.8 => 3.10.8
    @types/enzyme-adapter-react-16: ^1.0.6 => 1.0.6
    @types/jest: ^26.0.18 => 26.0.18
    @types/lodash.debounce: ^4.0.6 => 4.0.6
    @types/react: ^17.0.0 => 17.0.0
    @types/react-dom: ^17.0.0 => 17.0.0
    @types/react-resize-detector: ^5.0.0 => 5.0.0
    @types/webpack: ^4.41.25 => 4.41.25
    @typescript-eslint/eslint-plugin: ^4.9.1 => 4.9.1
    @typescript-eslint/eslint-plugin-tslint: ^4.9.1 => 4.9.1
    @typescript-eslint/parser: ^4.9.1 => 4.9.1
    awesome-typescript-loader: ^5.2.1 => 5.2.1
    babel-eslint: ^10.1.0 => 10.1.0
    babel-loader: ^8.2.2 => 8.2.2
    clean-webpack-plugin: ^3.0.0 => 3.0.0
    clipboard: ^2.0.6 => 2.0.6
    concurrently: ^5.3.0 => 5.3.0
    cross-env: ^7.0.3 => 7.0.3
    css-loader: ^5.0.1 => 5.0.1
    cypress: ^6.1.0 => 6.1.0
    cypress-plugin-tab: ^1.0.5 => 1.0.5
    enzyme: ^3.11.0 => 3.11.0
    enzyme-adapter-react-16: ^1.15.4 => 1.15.5
    enzyme-to-json: ^3.6.1 => 3.6.1
    eslint: ^7.15.0 => 7.15.0
    eslint-config-airbnb: ^18.2.1 => 18.2.1
    eslint-config-airbnb-typescript: ^12.0.0 => 12.0.0
    eslint-config-prettier: ^7.0.0 => 7.0.0
    eslint-config-react-app: ^6.0.0 => 6.0.0
    eslint-import-resolver-typescript: ^2.3.0 => 2.3.0
    eslint-loader: ^4.0.2 => 4.0.2
    eslint-plugin-flowtype: ^5.2.0 => 5.2.0
    eslint-plugin-import: ^2.22.1 => 2.22.1
    eslint-plugin-jsdoc: ^30.7.8 => 30.7.8
    eslint-plugin-jsx-a11y: ^6.4.1 => 6.4.1
    eslint-plugin-mdx: ^1.8.2 => 1.8.2
    eslint-plugin-prettier: ^3.2.0 => 3.2.0
    eslint-plugin-react: ^7.21.5 => 7.21.5
    eslint-plugin-react-hooks: ^4.2.0 => 4.2.0
    eslint-plugin-sort-class-members: ^1.8.0 => 1.8.0
    eslint-plugin-sort-destructure-keys: ^1.3.5 => 1.3.5
    filemanager-webpack-plugin: ^3.0.0-beta.0 => 3.0.0-beta.0
    fx: ^20.0.2 => 20.0.2
    html-validate: ^4.0.2 => 4.0.2
    hugo-bin: ^0.67.0 => 0.67.0
    husky: ^4.3.5 => 4.3.5
    if-env: ^1.0.4 => 1.0.4
    jest: ^26.6.3 => 26.6.3
    jest-config: ^26.6.3 => 26.6.3
    jest-environment-jsdom-fourteen: ^1.0.1 => 1.0.1
    jest-html-reporter: ^3.3.0 => 3.3.0
    jest-transform-stub: ^2.0.0 => 2.0.0
    lerna: ^3.22.1 => 3.22.1
    lint-staged: ^10.5.3 => 10.5.3
    live-server: ^1.2.1 => 1.2.1
    lodash.debounce: ^4.0.8 => 4.0.8
    majestic: ^1.8.0 => 1.8.0
    markdown-spellcheck: ^1.3.1 => 1.3.1
    markdownlint: ^0.22.0 => 0.22.0
    markdownlint-cli: ^0.25.0 => 0.25.0
    mini-css-extract-plugin: ^1.3.2 => 1.3.2
    moment: ^2.29.1 => 2.29.1
    npm-watch: ^0.7.0 => 0.7.0
    open-cli: ^6.0.1 => 6.0.1
    optimize-css-assets-webpack-plugin: ^5.0.4 => 5.0.4
    pa11y-ci: ^2.4.0 => 2.4.0
    patch-package: ^6.2.2 => 6.2.2
    percy: ^0.28.5 => 0.28.5
    prettier: ^2.2.1 => 2.2.1
    prettier-eslint: ^12.0.0 => 12.0.0
    prettier-eslint-cli: ^5.0.0 => 5.0.0
    react-docgen-typescript-loader: ^3.7.2 => 3.7.2
    react-docgen-typescript-webpack-plugin: ^1.1.0 => 1.1.0
    react-is: ^17.0.1 => 17.0.1
    react-scripts-ts: ^3.1.0 => 3.1.0
    react-test-renderer: ^17.0.1 => 17.0.1
    sass: ^1.30.0 => 1.30.0
    sass-loader: ^10.1.0 => 10.1.0
    source-map-loader: ^1.1.3 => 1.1.3
    standard: ^16.0.3 => 16.0.3
    style-loader: ^2.0.0 => 2.0.0
    stylelint: ^13.8.0 => 13.8.0
    stylelint-config-prettier: ^8.0.2 => 8.0.2
    stylelint-config-sass-guidelines: ^7.1.0 => 7.1.0
    stylelint-order: ^4.1.0 => 4.1.0
    svg-spritemap-webpack-plugin: 3.7.1 => 3.7.1
    svg-url-loader: ^7.1.1 => 7.1.1
    terser-webpack-plugin: ^5.0.3 => 5.0.3
    ts-jest: ^26.4.4 => 26.4.4
    ts-loader: ^8.0.11 => 8.0.11
    tslint: ^6.1.3 => 6.1.3
    tslint-react: ^5.0.0 => 5.0.0
    typescript: ^4.1.2 => 4.1.2
    typescript-eslint: ^0.0.1-alpha.0 => 0.0.1-alpha.0
    uglifyjs-webpack-plugin: ^2.2.0 => 2.2.0
    ui-kit-examples: file:examples/react => 1.12.0
    wait-on: ^5.2.0 => 5.2.0
    webpack: ^5.10.0 => 5.10.0
    webpack-cli: ^4.2.0 => 4.2.0
    yaml-front-matter: ^4.1.0 => 4.1.0

Minimal reproduction

It's a private repo and haven't had chance to do this yet but the plugin config looks like this:

    new SVGSpritemapPlugin('path/to/files/*.svg', {
      output: {
        filename: '../../path/to/output/sprite.svg',
        svg4everybody: true,
        svgo: true
      },
      sprite: {
        generate: {
          title: false
        },
        prefix: false
      }
    })

If necessary, I can try and recreate this in a repo 🙂

Additional context

n/a

cascornelissen commented 3 years ago

@markgaze, does the error include a stack trace by any chance?

markgaze commented 3 years ago

Ah, apologies, will recreate it and update the issue 🙂

markgaze commented 3 years ago

@cascornelissen I've added the stack trace now, cheers!

cascornelissen commented 3 years ago

@markgaze, thanks. I can't seem to reproduce this but I'm hoping the change in 9f44e93 fixes this. Could you test it out real quick by installing it directly from GitHub?

npm install cascornelissen/svg-spritemap-webpack-plugin#master
markgaze commented 3 years ago

Will do, thanks 🙂

markgaze commented 3 years ago

It works! 😄

Thanks again for your speedy response!

cascornelissen commented 3 years ago

Thank goodness, if that wasn't the issue this would've been really hard to debug... Thanks for your help!

The fix was released in 3.8.1 🚀

markgaze commented 3 years ago

Legend, thanks! ❤️

cascornelissen commented 3 years ago

Hi @markgaze, I just wanted to thank you for sponsoring me, that means a lot to me and actually made my day! ❤️

markgaze commented 3 years ago

Hi @markgaze, I just wanted to thank you for sponsoring me, that means a lot to me and actually made my day! ❤️

Glad to hear it! I know it's not a massive amount of money but I wanted to show my appreciation for your work and your quick turnaround has saved me with this issue and #126 so thank you! ❤️