browser-sync


Browser-sync - serve “node_modules” out of “src” directory


I'm using browsersync via lite-server, and have the following configuration:
{
"port": 8000,
"files": [
"./src/**/*.{html,htm,css,js}"
],
"server": {
"baseDir": "./src",
"routes": {
"node_modules": "../node_modules" <--- Attempt to serve node_modules
}
}
}
Project layout is like this:
node_modules
src
|-app
|-index.html
|-systemjs.config.js
package.json
bs-config.json
The problem is that inside index.html any reference like
<script src="node_modules/....js"> fails with a 404.
How can I serve paths outside of .src directory?
You can expose whole project folder by adding one more element to baseDir as Edvin mentioned.
But it would be better if you will expose only /node_modules using routes:
module.exports = {
server : {
baseDir : './dist',
routes : {
'/vendor' : './node_modules'
}
}
}
You can use multiple directory in baseDir config:
{
"server": {
"baseDir": ["./", "./src" ]
}
}

Related Links

Is it safe to include localhost into your connect-src for CSP?
Quit Browser-sync from terminal
lite-serverbs-config.js: middleware and array of folders
Make BrowserSync use the real https URL
Can we use browser sync on external url
How to replace .html with forward slash in BrowserSync?
Error during instillation of browser sync
When using browser-sync,why is the browser saying cannot get, while everything seems fine
How to sync the actions performed on webpage using Browsersync?
lite-server, BrowserSync: setting other URL path than /
Gulp and Browsersync injecting CSS but causing a full reload
Browser-sync - serve “node_modules” out of “src” directory
[browser-sync]browser-sync proxy can't connect to Rails Application
Browserstack not serving index.html by default
whatever i do i can't access the external URL for the site or UI
How do I kill browserSync before creating it?

Categories

HOME
delphi-7
developer-tools
merge
apache-jena
composite-primary-key
pclxl
alarm
nsbundle
nested-if
zip
bookmarks
angularfire2
title
syntaxnet
dkim
startup
opengl-es-3.0
angular-dart
speech-synthesis
frequency-distribution
gource
enterprise-architect
plink
atlassian
alpacajs
dreamweaver
replication
simpleitk
mongoid6
draft-js-plugins
definitelytyped
gpio
appirater
amazon-quicksight
datastax-enterprise-graph
panoramas
recurring-events
python-2.6
fstream
jett
classcastexception
indy10
modalviewcontroller
reverse
engine.io
openerp-7
parse-tree
jpad
google-data-api
setup.py
trigonometry
laravel-elixir
dcmtk
xbmc
configurationmanager
manova
java-bytecode-asm
appdomain
boxing
java-6
dt
quicktime
android-instrumentation
donations
materialized-path-pattern
actor-platform
microstation
signalr.client
cifilter
dimension
http-status-code-401
fink
xvim
page.js
skspritenode
jsvc
jquery-forms-plugin
diff3
procedural-programming
apache-spark-1.3
addressing-mode
big-ip
cocos3d
verold
ora-00904
grails-domain-class
live555
decoupling
hibernate-entitymanager
jammer
cmmi
epiceditor
swfobject
sqlclr
pyunit
correlated-subquery
appjs
mapping-by-code
wiimote
jquery-address
gobject-introspection
role
fsevents
winmain
automationelement
drawtobitmap
clrstoredprocedure
dot-emacs
qtabbar
django-piston
web-application-project
fail-fast-fail-early
fault-tolerance

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App