i'm getting started angular 2 , i'm trying use following folder structure:
- angular-app - src - dist - package.json where src actual source goes , dist production version goes after typescript compilation , forth.
now, run app, i've used quickstart suggestion, i've installed lite-server , have scripts section of package.json defined as:
"scripts": { "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ", "lite": "lite-server", "postinstall": "typings install", "tsc": "tsc", "tsc:w": "tsc -w", "typings": "typings" } now, tell lite-server code inside src i've added 1 folder configs root, 1 bs-config.json file contents:
{ "port": 3000, "files": ["./src/**/*.{html,htm,css,js}"], "server": { "basedir": "./src/" } } and changed lite script lite-server -c configs/bs-config.json.
now, serve files within src. locates inside there. there's issue.
on index.html there several scripts loading ../node_modules. , lite-server unaware of folder, returns 404 request going ../node_modules.
this big problem. how solve it? how request scripts inside ../node_modules within src , them served lite-server?
you can try add angular-app folder root bs-config.json file (note additional "." in basedir):
"server": { "basedir": ["./src", "."] } a reference following example in angular-app/src/index.html:
<script src="node_modules/core-js/client/shim.min.js"></script> would resolved (assuming nodes_modules has 'angular-app' parent folder).
Comments
Post a Comment