我想在本地运行我最近刚刚收到的Vue.js / System.js演示应用程序,之前从未使用过System.js(而且我不会...)
我只想在将其转换为webpack之前运行此演示... 没有npm脚本(所以没有安装,没有运行开发)
如何运行它以在我的本地浏览器中显示? 跑步前还有什么要做的吗? (没有关于它的文件......)
demo
app
components
About
App
..
index.js
routes
Home
...
index.js
style
main.css
assets
home
...
...
documentation
...
libs
favicon.ico
index.html
readme.html
更新
这是system.config
System.config({
defaultJSExtensions: true
, map: {
'app': './app'
, 'js': '/libs/js'
, 'style': '/libs/css'
, 'theme': '/app/theme'
, 'babel': '/libs/js/babel-core'
, 'components': '/app/components',
'routes': '/app/routes',
},
transpiler: 'babel'
, meta: {
'js/*.js': {
format: 'global'
}
}
});
System.import('/app/index.js');
和index.html
<!doctype html>
<html class="no-js" lang="en">"no-js" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="author" content="BelosTemas">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Test template</title>
<link rel="shortcut icon" type="image/png" href="favicon.ico" />
<link rel="stylesheet" href="./app/style/main.css" id="theme-stylesheet">
</head>
<body>
<div id="app">
<app></app>
</div>
<!-- system -->
<script src="/libs/js/system.js"></script>
<script src="/app/system.config.js"></script>
</body>
</html>
更新2
我更改了index.html相对路径中的脚本src路径(src =&#39; ./) 现在脚本文件位于..但它没有正确执行,与CORS相关的问题..
错误:
system.js:5无法加载文件:///app/index.js:交叉原始请求 只支持协议方案:http,data,chrome, chrome-extension,https。
答案 0 :(得分:1)
我解决了它,安装了一个轻量级的Web服务器
npm install -g live-server
然后在控制台中,转到我的app目录,我只是运行它
live-server
默认浏览器已打开http://localhost:8080 奖金:热重装!