{"action":"created","issue":{"url":"https://api.github.com/repos/vuejs/vue-cli/issues/1784","repository_url":"https://api.github.com/repos/vuejs/vue-cli","labels_url":"https://api.github.com/repos/vuejs/vue-cli/issues/1784/labels{/name}","comments_url":"https://api.github.com/repos/vuejs/vue-cli/issues/1784/comments","events_url":"https://api.github.com/repos/vuejs/vue-cli/issues/1784/events","html_url":"https://github.com/vuejs/vue-cli/issues/1784","id":339150494,"node_id":"MDU6SXNzdWUzMzkxNTA0OTQ=","number":1784,"title":"npm run build不能适配混合app相对路径\"./\"","user":{"login":"lanxuebao","id":15275286,"node_id":"MDQ6VXNlcjE1Mjc1Mjg2","avatar_url":"https://avatars1.githubusercontent.com/u/15275286?v=4","gravatar_id":"","url":"https://api.github.com/users/lanxuebao","html_url":"https://github.com/lanxuebao","followers_url":"https://api.github.com/users/lanxuebao/followers","following_url":"https://api.github.com/users/lanxuebao/following{/other_user}","gists_url":"https://api.github.com/users/lanxuebao/gists{/gist_id}","starred_url":"https://api.github.com/users/lanxuebao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lanxuebao/subscriptions","organizations_url":"https://api.github.com/users/lanxuebao/orgs","repos_url":"https://api.github.com/users/lanxuebao/repos","events_url":"https://api.github.com/users/lanxuebao/events{/privacy}","received_events_url":"https://api.github.com/users/lanxuebao/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-07-07T14:36:55Z","updated_at":"2018-07-18T02:18:26Z","closed_at":"2018-07-18T02:07:19Z","author_association":"NONE","body":"### Version\r\n3.0.0-rc.3\r\n\r\n### Reproduction link\r\n[http://www.baidu.com](http://www.baidu.com)\r\n\r\n### Steps to reproduce\r\n修改vue.config.js中的baseUrl为'./'\r\nmodule.exports = {\r\n    baseUrl: './'\r\n};\r\n然后执行npm run build\r\n\r\n### What is expected?\r\n所有URL都应以“./”开头，成为相对路径，以便适配混合app开发。\r\n\r\n建议一：\r\n将node_modules\\@vue\\cli-service\\lib\\config\\css.js中的`css/[name].[contenthash:8].css`\r\n修改为`./css/[name].[contenthash:8].css`,\r\n\r\n建议二：\r\n将node_modules\\@vue\\cli-service\\lib\\config\\prod.js中的`js/[name]${isLegacyBundle ? `-legacy` : ``}.[chunkhash:8].js`\r\n修改为`./js/[name]${isLegacyBundle ? `-legacy` : ``}.[chunkhash:8].js`\r\n\r\n### What is actually happening?\r\n在混合APP开发中所有的路径都应以相对路径，或者给别人做案例时也应该以相对路径URL开头，以达到只要浏览器访问index.html就能看到内容。如果仅仅修改baseUrl为\"./\"或\"\"，那么所有的编译的js和css都会生成在根目录下，很混乱。为了保证文件的可视阅读性，除index.html的文件都应该归类存储。\r\n\r\n---\r\n建议一：\r\n将node_modules\\@vue\\cli-service\\lib\\config\\css.js中的`css/[name].[contenthash:8].css`\r\n修改为`./css/[name].[contenthash:8].css`,\r\n\r\n建议二：\r\n将node_modules\\@vue\\cli-service\\lib\\config\\prod.js中的`js/[name]${isLegacyBundle ? `-legacy` : ``}.[chunkhash:8].js`\r\n修改为`./js/[name]${isLegacyBundle ? `-legacy` : ``}.[chunkhash:8].js`\r\n\r\n<!-- generated by vue-issues. DO NOT REMOVE -->"},"comment":{"url":"https://api.github.com/repos/vuejs/vue-cli/issues/comments/405787091","html_url":"https://github.com/vuejs/vue-cli/issues/1784#issuecomment-405787091","issue_url":"https://api.github.com/repos/vuejs/vue-cli/issues/1784","id":405787091,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNTc4NzA5MQ==","user":{"login":"lanxuebao","id":15275286,"node_id":"MDQ6VXNlcjE1Mjc1Mjg2","avatar_url":"https://avatars1.githubusercontent.com/u/15275286?v=4","gravatar_id":"","url":"https://api.github.com/users/lanxuebao","html_url":"https://github.com/lanxuebao","followers_url":"https://api.github.com/users/lanxuebao/followers","following_url":"https://api.github.com/users/lanxuebao/following{/other_user}","gists_url":"https://api.github.com/users/lanxuebao/gists{/gist_id}","starred_url":"https://api.github.com/users/lanxuebao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lanxuebao/subscriptions","organizations_url":"https://api.github.com/users/lanxuebao/orgs","repos_url":"https://api.github.com/users/lanxuebao/repos","events_url":"https://api.github.com/users/lanxuebao/events{/privacy}","received_events_url":"https://api.github.com/users/lanxuebao/received_events","type":"User","site_admin":false},"created_at":"2018-07-18T02:18:26Z","updated_at":"2018-07-18T02:18:26Z","author_association":"NONE","body":"我已经build成功了， 所有的css和js以及图片均加载正常，并且路径都是以\"./\"开头。\r\n另外：2楼通过配置webpack也达到了同样的目的，我只能说你是死脑筋....."}}
{"actor":{"display_login":"lanxuebao"}}