GithubHelp home page GithubHelp logo

Comments (3)

cgmartin avatar cgmartin commented on July 20, 2024 5

Try multiple base directories:
(via https://www.browsersync.io/docs/options/#option-server)

// Multiple base directories
server: {
    baseDir: ["src", "node_modules"]
}

from lite-server.

emramos avatar emramos commented on July 20, 2024 4

I've just faced a similar issue.
If you include "node_modules" as part of baseDir, it becomes part of the root structure. All files inside node_modules will become directly available to the rest of the application.

Therefore, you should not reference it anymore:

<script src="core-js/client/shim.min.js"></script>
<script src="zone.js/dist/zone.js"></script>
<script src="reflect-metadata/Reflect.js"></script>
<script src="systemjs/dist/system.src.js"></script>

If you want to keep referencing node_modules inside your index.html, a better approach is to add a route in your bs-config.js:

{
  "server": { "baseDir": "angular2/system",  "routes" : { "/node_modules" : "./node_modules"} }
 }

from lite-server.

woleicom avatar woleicom commented on July 20, 2024

dir:
app
|-- node_modules
|-- angular2
------|-- system
------------|-- index.html

index.html:

<script src="../../node_modules/core-js/client/shim.min.js"></script>
<script src="../../node_modules/zone.js/dist/zone.js"></script>
<script src="../../node_modules/reflect-metadata/Reflect.js"></script>
<script src="../../node_modules/systemjs/dist/system.src.js"></script>

bs-config.js:

{
  "port": 8989,
  "server": { "baseDir": ["angular2/system","node_modules"]}
}

error:

[BS] Watching files...
16.07.20 09:04:31 304 GET /index.html
16.07.20 09:04:35 304 GET /styles.css
16.07.20 09:04:35 304 GET /systemjs.config.js
16.07.20 09:04:35 404 GET /node_modules/core-js/client/shim.min.js
16.07.20 09:04:35 404 GET /node_modules/zone.js/dist/zone.js
16.07.20 09:04:35 404 GET /node_modules/reflect-metadata/Reflect.js
16.07.20 09:04:35 404 GET /node_modules/systemjs/dist/system.src.js

BaseDir add more or less, I would like to ask how to configure?

from lite-server.

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.