Alias a npm module with browserify shim

ThomasReggi

I'm moving from requirejs to browserify.

I have a dependency for masonry.

That was proving a little difficult (more on that here), to shim using the bower version.

So I just installed it with npm which installs it as masonry-layout.

My question is: How can I shim the named import of a npm modules with thlorenz/browserify-shim? So I don't have to change every reference in my code from masonry to masonry-layout.

JMM

I don't think that's the right use case for browserify-shim. Here are a few ideas:

  • You might be able to accomplish what you want using the browser field in package.json. E.g.:

    "browser": {
      "masonry": "masonry-layout"
    }
    
  • If you don't care about being able to install the masonry package as a dependency of the same project and you have symlinks you could symlink node_modules/masonry to node_modules/masonry-layout.

  • You could try my pathmodify browserify plugin.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Angular-Laddaがbrowserifyで正しく機能しない-shim / browserify

分類Dev

browserify exclude cannot find module

分類Dev

jqueryはどこから必要になりますか?--browserify --browserify-shim

分類Dev

browserify-shimを期待どおりに機能させる

分類Dev

browserifyバンドルにes5-shimを含める方法

分類Dev

browserify-shimを使用した依存関係のシミング依存関係

分類Dev

package.jsonなしでbrowserify-shimを使用する方法はありますか?

分類Dev

Browserify / Shim CDN jQuery を使用したスリック カルーセル

分類Dev

Browserify:同じnpm-moduleを同じアプリケーションに複数回含めないようにする

分類Dev

esm does not resolve module-alias

分類Dev

Npm link and shared module instances

分類Dev

NPM cannot find module bash

分類Dev

Browserify-shimで一般的なjQueryプラグインを構成しますか?

分類Dev

npm iとnpmがgulpを壊し、browserifyビルドを更新します

分類Dev

NPM対Bower対Browserify対Gulp対Grunt対Webpack

分類Dev

Error: cannot find module npm-shrinkwrap

分類Dev

MODULE_NOT_FOUND error on npm install

分類Dev

Meteor can't find local npm module

分類Dev

Specify NPM module platform to use in Angular

分類Dev

Symlink to file within same NPM module

分類Dev

How to mock npm module with sinon/mocha

分類Dev

Creating an npm module with target specific code

分類Dev

first publish npm module does not download dependencies

分類Dev

NPM cluster module and listening on different ports

分類Dev

Using debug NPM module with fish shell

分類Dev

Why `type alias` a type that is defined the same way in another module?

分類Dev

javascriptとbrowserifyを使用したmodule.exportsでrequire()を理解する

分類Dev

browserify-shimは、varスコープの場合に暗黙のグローバルをエクスポートしません

分類Dev

browserify-shimを使用した偽のグローバルjQuery?(モジュール 'jquery'が見つかりません)

Related 関連記事

  1. 1

    Angular-Laddaがbrowserifyで正しく機能しない-shim / browserify

  2. 2

    browserify exclude cannot find module

  3. 3

    jqueryはどこから必要になりますか?--browserify --browserify-shim

  4. 4

    browserify-shimを期待どおりに機能させる

  5. 5

    browserifyバンドルにes5-shimを含める方法

  6. 6

    browserify-shimを使用した依存関係のシミング依存関係

  7. 7

    package.jsonなしでbrowserify-shimを使用する方法はありますか?

  8. 8

    Browserify / Shim CDN jQuery を使用したスリック カルーセル

  9. 9

    Browserify:同じnpm-moduleを同じアプリケーションに複数回含めないようにする

  10. 10

    esm does not resolve module-alias

  11. 11

    Npm link and shared module instances

  12. 12

    NPM cannot find module bash

  13. 13

    Browserify-shimで一般的なjQueryプラグインを構成しますか?

  14. 14

    npm iとnpmがgulpを壊し、browserifyビルドを更新します

  15. 15

    NPM対Bower対Browserify対Gulp対Grunt対Webpack

  16. 16

    Error: cannot find module npm-shrinkwrap

  17. 17

    MODULE_NOT_FOUND error on npm install

  18. 18

    Meteor can't find local npm module

  19. 19

    Specify NPM module platform to use in Angular

  20. 20

    Symlink to file within same NPM module

  21. 21

    How to mock npm module with sinon/mocha

  22. 22

    Creating an npm module with target specific code

  23. 23

    first publish npm module does not download dependencies

  24. 24

    NPM cluster module and listening on different ports

  25. 25

    Using debug NPM module with fish shell

  26. 26

    Why `type alias` a type that is defined the same way in another module?

  27. 27

    javascriptとbrowserifyを使用したmodule.exportsでrequire()を理解する

  28. 28

    browserify-shimは、varスコープの場合に暗黙のグローバルをエクスポートしません

  29. 29

    browserify-shimを使用した偽のグローバルjQuery?(モジュール 'jquery'が見つかりません)

ホットタグ

アーカイブ