Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 5.2.4 errors when building with webpack (Can't resolve 'document' and 'window') #1755

Closed
6 of 14 tasks
rjaros opened this issue Sep 19, 2021 · 1 comment
Closed
6 of 14 tasks

Comments

@rjaros
Copy link

rjaros commented Sep 19, 2021

Prerequisites

  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • The issue still exists against the latest master branch of bootstrap-fileinput.
  • This is not an usage question. I confirm having read the plugin documentation and demos.
  • This is not a general programming / coding question. (Those should be directed to the webtips Q & A forum).
  • I have attempted to find the simplest possible steps to reproduce the issue.
  • I have included a failing test as a pull request (Optional).

Steps to reproduce the issue

  1. clone repository: https://github.com/rjaros/bootstrap-fileinput-524-example
  2. run npm install
  3. run npx webpack

Expected behavior and actual behavior

When I follow those steps, I see...

ERROR in ./node_modules/bootstrap-fileinput/js/fileinput.js 
Module not found: Error: Can't resolve 'document' in '/opt/rjaros/temp/webpack-demo/node_modules/bootstrap-fileinput/js'
resolve 'document' in '/opt/rjaros/temp/webpack-demo/node_modules/bootstrap-fileinput/js'
  Parsed request is a module
  using description file: /opt/rjaros/temp/webpack-demo/node_modules/bootstrap-fileinput/package.json (relative path: ./js)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      /opt/rjaros/temp/webpack-demo/node_modules/bootstrap-fileinput/js/node_modules doesn't exist or is not a directory
      /opt/rjaros/temp/webpack-demo/node_modules/bootstrap-fileinput/node_modules doesn't exist or is not a directory
      /opt/rjaros/temp/webpack-demo/node_modules/node_modules doesn't exist or is not a directory
      looking for modules in /opt/rjaros/temp/webpack-demo/node_modules
        single file module
          using description file: /opt/rjaros/temp/webpack-demo/package.json (relative path: ./node_modules/document)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /opt/rjaros/temp/webpack-demo/node_modules/document doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /opt/rjaros/temp/webpack-demo/node_modules/document.js doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              /opt/rjaros/temp/webpack-demo/node_modules/document.json doesn't exist
            .wasm
              Field 'browser' doesn't contain a valid alias configuration
              /opt/rjaros/temp/webpack-demo/node_modules/document.wasm doesn't exist
        /opt/rjaros/temp/webpack-demo/node_modules/document doesn't exist
      /opt/rjaros/temp/node_modules doesn't exist or is not a directory
      /opt/rjaros/node_modules doesn't exist or is not a directory
      /opt/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
 @ ./src/index.js 2:0-37

ERROR in ./node_modules/bootstrap-fileinput/js/fileinput.js 
Module not found: Error: Can't resolve 'window' in '/opt/rjaros/temp/webpack-demo/node_modules/bootstrap-fileinput/js'
resolve 'window' in '/opt/rjaros/temp/webpack-demo/node_modules/bootstrap-fileinput/js'
  Parsed request is a module
  using description file: /opt/rjaros/temp/webpack-demo/node_modules/bootstrap-fileinput/package.json (relative path: ./js)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      /opt/rjaros/temp/webpack-demo/node_modules/bootstrap-fileinput/js/node_modules doesn't exist or is not a directory
      /opt/rjaros/temp/webpack-demo/node_modules/bootstrap-fileinput/node_modules doesn't exist or is not a directory
      /opt/rjaros/temp/webpack-demo/node_modules/node_modules doesn't exist or is not a directory
      looking for modules in /opt/rjaros/temp/webpack-demo/node_modules
        single file module
          using description file: /opt/rjaros/temp/webpack-demo/package.json (relative path: ./node_modules/window)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /opt/rjaros/temp/webpack-demo/node_modules/window doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /opt/rjaros/temp/webpack-demo/node_modules/window.js doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              /opt/rjaros/temp/webpack-demo/node_modules/window.json doesn't exist
            .wasm
              Field 'browser' doesn't contain a valid alias configuration
              /opt/rjaros/temp/webpack-demo/node_modules/window.wasm doesn't exist
        /opt/rjaros/temp/webpack-demo/node_modules/window doesn't exist
      /opt/rjaros/temp/node_modules doesn't exist or is not a directory
      /opt/rjaros/node_modules doesn't exist or is not a directory
      /opt/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
 @ ./src/index.js 2:0-37

webpack 5.53.0 compiled with 2 errors and 1 warning in 4089 ms

I was expecting...

webpack 5.53.0 compiled with 4 warnings in 4129 ms

Environment

Browsers

Not applicable. The error affects the build process.

Operating System

  • Windows
  • Mac OS X
  • Linux
  • Mobile

Libraries

  • bootstrap-fileinput version: 5.2.4

Isolating the problem

  • This bug happens on the plugin demos page
  • The bug happens consistently across all tested browsers
  • This bug happens when using bootstrap-fileinput without other plugins
  • I can reproduce this bug in a jsbin
@rjaros
Copy link
Author

rjaros commented Sep 19, 2021

Thanks!

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

No branches or pull requests

2 participants