selectize.js icon indicating copy to clipboard operation
selectize.js copied to clipboard

Usage through Webpack: "Error: Can't resolve 'sifter'"

Open fapdash opened this issue 3 years ago • 1 comments


I did:

  • [x] Search for if my issue has already been submitted
  • [x] Make sure I'm reporting something precise that needs to be fixed
  • [x] Give my issue a descriptive and concise title
  • [ ] Create a minimal working example on JsFiddle or Codepen (or gave a link to a demo on the Selectize docs)
  • [x] Indicate precise steps to reproduce in numbers and the result, like below

[replace me with a short description of issue]

Steps to reproduce:

  1. Install selectize
$ yarn add @selectize/selectize
yarn add v1.22.10
warning ../../../package.json: No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 12 new dependencies.
info Direct dependencies
└─ @selectize/[email protected]
info All dependencies
├─ @selectize/[email protected]
├─ @selectize/[email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
Done in 8.33s.
  1. Import selectize in the entrypoint
require("@selectize/selectize");
  1. Run webpack bundle

Expected result: Webpack bundle succeeds. This worked with version 0.12.6 from https://www.npmjs.com/package/selectize Fails with 0.13.6 from https://www.npmjs.com/package/@selectize/selectize.

Actual result:

ERROR in ./node_modules/@selectize/selectize/dist/js/selectize.js
Module not found: Error: Can't resolve 'sifter' in '/home/fap/repos/project/com.vogella.project/node_modules/@selectize/selectize/dist/js'
resolve 'sifter' in '/home/fap/repos/project/com.vogella.project/node_modules/@selectize/selectize/dist/js'
  Parsed request is a module
  using description file: /home/fap/repos/project/com.vogella.project/node_modules/@selectize/selectize/package.json (relative path: ./dist/js)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      /home/fap/repos/project/com.vogella.project/node_modules/@selectize/selectize/dist/js/node_modules doesn't exist or is not a directory
      /home/fap/repos/project/com.vogella.project/node_modules/@selectize/selectize/dist/node_modules doesn't exist or is not a directory
      looking for modules in /home/fap/repos/project/com.vogella.project/node_modules/@selectize/selectize/node_modules
        single file module
          using description file: /home/fap/repos/project/com.vogella.project/node_modules/@selectize/selectize/package.json (relative path: ./node_modules/sifter)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /home/fap/repos/project/com.vogella.project/node_modules/@selectize/selectize/node_modules/sifter doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /home/fap/repos/project/com.vogella.project/node_modules/@selectize/selectize/node_modules/sifter.js doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              /home/fap/repos/project/com.vogella.project/node_modules/@selectize/selectize/node_modules/sifter.json doesn't exist
            .wasm
              Field 'browser' doesn't contain a valid alias configuration
              /home/fap/repos/project/com.vogella.project/node_modules/@selectize/selectize/node_modules/sifter.wasm doesn't exist
        /home/fap/repos/project/com.vogella.project/node_modules/@selectize/selectize/node_modules/sifter doesn't exist
      /home/fap/repos/project/com.vogella.project/node_modules/@selectize/node_modules doesn't exist or is not a directory
      /home/fap/repos/project/com.vogella.project/node_modules/node_modules doesn't exist or is not a directory
      looking for modules in /home/fap/repos/project/com.vogella.project/node_modules
        single file module
          using description file: /home/fap/repos/project/com.vogella.project/package.json (relative path: ./node_modules/sifter)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /home/fap/repos/project/com.vogella.project/node_modules/sifter doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /home/fap/repos/project/com.vogella.project/node_modules/sifter.js doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              /home/fap/repos/project/com.vogella.project/node_modules/sifter.json doesn't exist
            .wasm
              Field 'browser' doesn't contain a valid alias configuration
              /home/fap/repos/project/com.vogella.project/node_modules/sifter.wasm doesn't exist
        /home/fap/repos/project/com.vogella.project/node_modules/sifter doesn't exist
      looking for modules in /home/fap/repos/project/node_modules
        single file module
          using description file: /home/fap/package.json (relative path: ./repos/project/node_modules/sifter)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /home/fap/repos/project/node_modules/sifter doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /home/fap/repos/project/node_modules/sifter.js doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              /home/fap/repos/project/node_modules/sifter.json doesn't exist
            .wasm
              Field 'browser' doesn't contain a valid alias configuration
              /home/fap/repos/project/node_modules/sifter.wasm doesn't exist
        /home/fap/repos/project/node_modules/sifter doesn't exist
      /home/fap/repos/node_modules doesn't exist or is not a directory
      looking for modules in /home/fap/node_modules
        single file module
          using description file: /home/fap/package.json (relative path: ./node_modules/sifter)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /home/fap/node_modules/sifter doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /home/fap/node_modules/sifter.js doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              /home/fap/node_modules/sifter.json doesn't exist
            .wasm
              Field 'browser' doesn't contain a valid alias configuration
              /home/fap/node_modules/sifter.wasm doesn't exist
        /home/fap/node_modules/sifter doesn't exist
      /home/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
 @ ./src/main/resources/scripts/main.js 8:0-31

Sifter is installed in project/node_modules/@selectize/sifter but webpack looks for a node_modules folder directly containing sifter starting from project/node_modules/@selectize/selectize.

fapdash avatar Aug 25 '22 19:08 fapdash

I manually installed the old sifter to make it compile at the moment.

sabas avatar Sep 19 '22 13:09 sabas

Starting with version 0.14 sifter and microplugin are no longer external dependencies. While I don't personally use webpack this should no longer be an issue. Can somebody please assist in confirming?

risadams avatar Oct 18 '22 13:10 risadams