search

Home  >  Q&A  >  body text

node.js - node import file problem

Generally speaking, when we introduce a package, we just import Pack from 'pack';
But I saw a lot of packages, there are different versions in the folder, and there are more than one file that needs to be used. It is js, or it may require a css file. In this case, which file should be declared in it?
Or directly:
import Pack from 'pack/dist/...';

ringa_leeringa_lee2794 days ago428

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-05-16 13:39:07

    There is a main attribute in package.json that points to the root, usually index.js or the like.

    reply
    0
  • Cancelreply