Browserify and bower. Canonical approach

前端 未结 2 1926
离开以前
离开以前 2021-01-30 09:22

The way I\'m using packages that not available out of the box in npm, right now is like that:

package.json has:

 \"napa\": {
     \"angular\": \"angular         


        
2条回答
  •  自闭症患者
    2021-01-30 10:05

    You can try to install via debowerify

    The package.json may then look as follows:

    {
      "name": "browserify-begin",
      "version": "0.0.0",
      "dependencies": {
      },
      "browserify": {
        "transform": [
          "debowerify"
        ]
      },
      "devDependencies": {
        "browserify": "^4.1.5",
        "debowerify": "^0.7.1",
        "grunt": "^0.4.5"
      }
    }
    

    Given angular is installed with

    bower install angular
    

    Then within the js file will be as follows:

    require("angular");
    

提交回复
热议问题