简体   繁体   中英

On using a npm module in a Meteor package

If I install the npm module bootstrap4-tagsinput-douglasanpa in the main Meteor application I can use it by importing its files

import '../node_modules/bootstrap4-tagsinput-douglasanpa/tagsinput.js';
import '../node_modules/bootstrap4-tagsinput-douglasanpa/tagsinput.css';

But if I use this npm module inside a Meteor package with

Npm.depends({
  "bootstrap4-tagsinput-douglasanpa": "4.1.2"
});

I can not use

import '../.npm/package/node_modules/bootstrap4-tagsinput-douglasanpa/tagsinput.js';
import '../.npm/package/node_modules/bootstrap4-tagsinput-douglasanpa/tagsinput.css';

as the .npm directory contains a dot and is not compiled in the application

How can I use this npm module inside a package without the need to install it at application level ?

Well well well, just importing without the full path works.... silly me.

import 'bootstrap4-tagsinput-douglasanpa/tagsinput.js';
import 'bootstrap4-tagsinput-douglasanpa/tagsinput.css';

@Jankapunkt: add an answer and I will happily mark your answer as the solution

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM