Code Monkey home page Code Monkey logo

Comments (6)

ball-hayden avatar ball-hayden commented on July 30, 2024 3

This is not an aliasify issue, but a browserify one.

A transform is only applied to source files, not node_modules
If you wish to apply aliasify to all files, you should run it as a "global transform"

(I had the same problem, and found this out via browserify/browserify#501)

from aliasify.

anthonyhastings avatar anthonyhastings commented on July 30, 2024 1

Yes you seem to be correct. Whenever specifying the transform, we seem to need to set global i.e.

    bundle.transform('aliasify', {
        aliases: {
            'backbone': 'exoskeleton'
        },
        verbose: true,
        global: true
    })

Apologies for the confusion, I guess that's down to me being unclear as to how transforms work. There's a lot of the Browserify documents to digest!

from aliasify.

tj avatar tj commented on July 30, 2024 1

Seems to not work for me, I have:

  "browserify": {
    "transform": [
      ["aliasify", {
        "global": true,
        "debug": true,
        "aliases": {
          "react": "preact-compat",
          "react-dom": "preact-compat"
        }
      }]
    ]
  },

and still get plenty of:

Error: Cannot find module 'react' from '/Users/tj/dev/src/github.com/tj/vitals/client/node_modules/react-router/lib'
Error: Cannot find module 'react' from '/Users/tj/dev/src/github.com/tj/vitals/client/node_modules/react-router/lib'

I tried adding the package.json config as mentioned in the readme, but that seems to have no effect. Any suggestions?

from aliasify.

anthonyhastings avatar anthonyhastings commented on July 30, 2024

I'm having an almost identical problem but with trying to use Exoskeleton with backbone.nativeview. My problem is the same as yours though; Aliasify will cycle through my SOURCE FILES, but ignores looking in the dependencies that I have in my node_modules folder.

[10:07:42] Starting 'scripts'...
aliasify - /var/www/planner/app/static/js/src/main.js: replacing backbone with exoskeleton
Browserify Failed: Cannot find module 'backbone' from '/var/www/planner/app/static/node_modules/backbone.nativeview'
[10:07:42] 'scripts' errored after 854 ms

How do we make Aliasify cycle not just our source files, but the dependencies loaded from node_modules?

from aliasify.

michaelBenin avatar michaelBenin commented on July 30, 2024

This might help with defining global transforms in the package.json:

browserify/browserify#566

from aliasify.

tj avatar tj commented on July 30, 2024

Breaks on const's, seems like it's working now otherwise!

from aliasify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.