Giter VIP home page Giter VIP logo

Comments (7)

schpet avatar schpet commented on May 13, 2024 4

@joerodrig3 @merqlove I was able to use jest without symlinks by setting NODE_PATH in vendor/package.json:

  "scripts": {
    "test": "NODE_PATH='./node_modules:../app/javascript' jest"
  },
  "jest": {
    "testPathDirs": [
      "../app/javascript"
    ]
  }

After that I just had to create a .babelrc in the root of my project, replicating my webpack plugin setup.

from webpacker.

joerodrig avatar joerodrig commented on May 13, 2024 1

@schpet Thanks for that! That actually seems a lot better than the symlink solution

from webpacker.

merqlove avatar merqlove commented on May 13, 2024

Hi, what is a problem to run bin/yarn?)
But yes, here easy to mistake, just first time.
Also you can try to run cd vendor; yarn

About tasks:
You can write any scripts you want in the package.json, then run it with YARN or with NPM.

from webpacker.

joerodrig avatar joerodrig commented on May 13, 2024

The concern I have with bin/yarn is that in some cases, such as deploying to Heroku, it seems like we have to create a yarn.lock file and package.json file in the root directory of the app anyway to trick Heroku into installing yarn as a dependency. What benefits are there to organizing those files in vendor if we need to create/symlink them in root to get our app deployed and/or get client specs running? It seems like creating these duplicate files adds unnecessary complexity, but I'd also like to know more about why the choice was made to move these files into vendor!

As 3rd party packages, I can understand why node_modules would be put in vendor, but it seems odd to me that package.json and yarn.lock would be put in there as well. I think of them as config files that you typically expect access to on the root level, similar to Gemfile and Gemfile.lock

from webpacker.

merqlove avatar merqlove commented on May 13, 2024

package.json must be at the same level, as modules folder. So if we have it at vendor level, then it's modules folder will be in vendor too.
But yes, for example in Phoenix framework node_modules, package.json sitting at the root level. And it just works.

About symlinks, yep it works like workaround, but better is avoid symlinks.

from webpacker.

dhh avatar dhh commented on May 13, 2024

from webpacker.

merqlove avatar merqlove commented on May 13, 2024

@schpet same here, also we can use Makefile :)

from webpacker.

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.