{"action":"closed","issue":{"url":"https://api.github.com/repos/hoperyy/webpacker/issues/12","repository_url":"https://api.github.com/repos/hoperyy/webpacker","labels_url":"https://api.github.com/repos/hoperyy/webpacker/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/hoperyy/webpacker/issues/12/comments","events_url":"https://api.github.com/repos/hoperyy/webpacker/issues/12/events","html_url":"https://github.com/hoperyy/webpacker/issues/12","id":276829566,"number":12,"title":"webpack 一些容易混淆的地方","user":{"login":"hoperyy","id":5757051,"avatar_url":"https://avatars1.githubusercontent.com/u/5757051?v=4","gravatar_id":"","url":"https://api.github.com/users/hoperyy","html_url":"https://github.com/hoperyy","followers_url":"https://api.github.com/users/hoperyy/followers","following_url":"https://api.github.com/users/hoperyy/following{/other_user}","gists_url":"https://api.github.com/users/hoperyy/gists{/gist_id}","starred_url":"https://api.github.com/users/hoperyy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hoperyy/subscriptions","organizations_url":"https://api.github.com/users/hoperyy/orgs","repos_url":"https://api.github.com/users/hoperyy/repos","events_url":"https://api.github.com/users/hoperyy/events{/privacy}","received_events_url":"https://api.github.com/users/hoperyy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-11-26T14:41:25Z","updated_at":"2018-05-08T03:09:39Z","closed_at":"2018-05-08T03:09:39Z","author_association":"OWNER","body":"参考文章：http://www.qinshenxue.com/article/20170315092242.html\r\n\r\n+   `context`\r\n    +   功能\r\n\r\n        `context` 是 webpack 编译时的基础目录，入口起点（`entry`）会相对于此目录查找。\r\n        \r\n    +   默认值\r\n\r\n        `process.cwd()`\r\n        \r\n    +   路径\r\n\r\n        必须是绝对路径\r\n        \r\n    +   相关\r\n        +   `output` 和它无关\r\n        +   有些插件的配置和它有关\r\n\r\n+   `output.path`\r\n    +   功能\r\n\r\n        打包文件输出的目录\r\n        \r\n    +   默认值\r\n\r\n        和 `context` 一样，都是 `process.cwd()`\r\n        \r\n    +   配置\r\n\r\n        除了常规的配置方式，还可以在 path 中用使用 `[hash]` 模板，比如配置：`path: path.resolve('./dist/[hash:8]/')`\r\n        \r\n    +   路径\r\n\r\n        建议设置为绝对路径，相对路径不会报错\r\n        \r\n    +   相关\r\n\r\n        有些插件的配置项和 `context` 有关\r\n\r\n+   `output.publicPath`\r\n\r\n    +   规则\r\n\r\n        `静态资源最终访问路径 = output.publicPath + 资源 loader 或插件等配置路径`\r\n\r\n    +   默认\r\n\r\n        空字符串\r\n        \r\n    +   路径\r\n\r\n        +   相对路径\r\n        \r\n            设置为相对路径时，实际上是相对于 `html` 文件的路径\r\n            \r\n        +   绝对路径\r\n        \r\n            也可以设置为相对协议（`//`）或 http 地址（`http://`）\r\n\r\n    +   有关\r\n    \r\n        `publicPath` 应该以 `/` 结尾，同时其他 loader 或插件的配置不要以 `/` 开头\r\n\r\n+   webpack-dev-server： `publicPath`\r\n    \r\n    +   功能\r\n\r\n        用于开发环境，不会出现绝对路径\r\n        \r\n    +   为了提供浏览器访问打包资源的功能，提供了浏览器访问打包资源的功能。\r\n\r\n        webpack 中的 loader 和插件仍然是取 `ouput.publicPath`。\r\n        \r\n        比如如果设置为 `/web/`，访问 CSS 文件是 `127.0.0.1:8080/web/index.css`。\r\n        但CSS 里面的图片最终的路径仍是 `/static/img/xxxx.png`。\r\n\r\n"}}
{"actor":{"display_login":"hoperyy"}}