Skip to content

lamejs is not optional #190

@etschelp

Description

@etschelp

I'm no JS expert and I might be totally wrong here, but according to the Readme and the projects package.json the dependency to lamejs is marked as optional, so I would expect that when I add vue-advanced-chat as a dependency and then run npm install --no-optional that lamejs is not installed locally.

What happens per default is that lamejs is installed anyway and it is also set to required according to the contents of package-lock.json. If I overwrite this behaviour and explicitly set lamejs to optional in my local package.json like

  "optionalDependencies": {
    "lamejs": "^1.2.0"
  }

lamejs is not installed. When I now run npm serve I see the following in my console:

 ERROR  Failed to compile with 1 error                                                                                                                                                                                                            2:39:36 PM

This dependency was not found:

* lamejs in ./node_modules/vue-advanced-chat/dist/vue-advanced-chat.common.js

To install it, you can run: npm install --save lamejs

In this bundle file I see that one module indeed directly requires lamejs. This might be one issue, and the other issue might be that your package.json defines lamejs twice. The npm documentation says:

https://docs.npmjs.com/cli/v7/configuring-npm/package-json#optionaldependencies

Entries in optionalDependencies will override entries of the same name in dependencies, so it's usually best to only put in one place.

So it might be cleaner to delete the dependency entry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions