Giter VIP home page Giter VIP logo

Comments (7)

dominikj111 avatar dominikj111 commented on June 3, 2024 1

Ah, I see the whole picture now ... because I'm running webpack which is in the parent, it doesn't know about the webpack-dev-server. Sorry it is quite obvious.

Well, I would to point that on my local NODE_PATH is empty by default and to have webpack-dev-server in child and the rest in parent I need to locate both node_modules folders.

NODE_PATH="$NODE_PATH:/Users/*****/my/development/parent-app/child-app/node_modules:/Users/*****/my/development/parent-app/node_modules" npm run serve:dev

for reference.

from webpack-cli.

alexander-akait avatar alexander-akait commented on June 3, 2024

It is a limitation you should have webpack-cli on the same level on webpack-dev-server

from webpack-cli.

dominikj111 avatar dominikj111 commented on June 3, 2024

I understand that there may be some limits. So if it is meant to work like this it is ok, but I would expect some level of consistency at least in case where webpack is installed automatically when running npm i webpack-dev-server, but webpack-cli doesn't .

from webpack-cli.

dominikj111 avatar dominikj111 commented on June 3, 2024

Aha, I see your point now @alexander-akait so wouldn't be better to install all dependencies (+ webpack-cli in my case) automatically or maybe even better, just throw an error with meaningful message and do not install anything, because this is more educative for developers I think. Also I'm thinking about webpack-dev-server as additional thing/plugin, so it doesn't make sense to install anythig if I'm going to use plugin. It is like because I want to install some Wordpress plugin, the Wordpress will install automatically as a plugin dependecy, this seems to me oposite direction of thinking.

from webpack-cli.

alexander-akait avatar alexander-akait commented on June 3, 2024

@dominikj111 It is not related to webpack-dev-server, there is a logic and answer why it doesn't work https://github.com/webpack/webpack-cli/blob/master/packages/webpack-cli/src/webpack-cli.ts#L140, no magic, we can't do what you want and no one package can do it - you can't require/import package on the parent level and awating loading it from child, sorry

Webpack-dev-server is not full featured CLI, it is just a runner for webpack-cli

from webpack-cli.

dominikj111 avatar dominikj111 commented on June 3, 2024

@alexander-akait I just don't understand why.
And you wrote the apposite direction I'm talking about in this issue. I want to install package in the parent and then I want to require/import in the child.
And that really works, I just install express in the parent and then I did require in the child and in the child I ran node index.js and it works.

If I'm wrong, just explain why and we close this issue without resolving it. But from my perspective it is a buggy behavior even there is not problem with running it, but the architecture self I suppose.

from webpack-cli.

alexander-akait avatar alexander-akait commented on June 3, 2024

Shortly :

Another solution without installing the webpack-cli is to set the NODE_PATH, so command
NODE_PATH="$NODE_PATH:/usr/src/app/child-app/node_modules" ./node_modules/.bin/webpack serve --mode development
will serve as expected also.

It is not a workaround, it is a valid solution

from webpack-cli.

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.