webpack OSS All In One
阿里雲 OSS
對象存儲(Object Storage Service,簡稱OSS),是阿里雲對外提供的海量、安全和高可靠的雲存儲服務
https://cn.aliyun.com/product/oss
Sentry SourceMap & 401 bug
https://github.com/getsentry/sentry/issues?q=sourcemap
https://github.com/getsentry/sentry/issues?q=sourcemap+401
ERROR in Sentry CLI Plugin: Command failed: /Users/xgqfrms/Documents/gitlab-projects/vue-web-app/node_modules/@sentry/cli/sentry-cli releases new cbb76f651b4ee0f76da3aaf98b848ff8ef29409a
error: API request failed
caused by: sentry reported an error: Invalid token (http status: 401)
Add --log-level=[info|debug] or export SENTRY_LOG_LEVEL=[info|debug] to see more output.
Please attach the full debug log to all bug reports.
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
issues
https://github.com/getsentry/sentry/issues/20916
https://forum.sentry.io/t/offline-sourcemaps-not-used/548/3
https://github.com/getsentry/sentry/issues/10136
https://github.com/getsentry/sentry-webpack-plugin/issues/90
Uploading Source Maps
https://docs.sentry.io/platforms/javascript/sourcemaps/uploading/
https://docs.sentry.io/product/cli/releases/
Sentry
安裝 webpack-plugin(假設我們用的 webpack 作為編譯工具,或者其他基於 webpack 的編譯工具如 umi)
$ npm install @sentry/webpack-plugin --save-dev
增加 webpack配置,調用 sentry插件(這里我們用的 umi 配置)
import SentryWebpackPlugin from '@sentry/webpack-plugin';
{
// ...
// 開啟source-map
devtool: 'source-map',
oss: {
ignore: {
// 不上傳map文件
extname: ['.map'],
},
},
chainWebpack(config) {
// ...
config.plugin('sentry').use(SentryWebpackPlugin, [
{
// release名稱(項目名+@+版本號)
release: `react-web-app@${pkg.version}`,
// 編譯后靜態文件的輸出文件夾
include: '../server/app/public',
// 靜態文件的cdn地址
urlPrefix: `https://cdn.xgqfrms.xyz/static/${pkg.version}`,
// 上傳release時覆蓋之前的
rewrite: true,
},
]);
},
// ...
}
webpack 自動上傳靜態資源到 OSS
https://juejin.cn/post/6844903809760624654
https://www.npmjs.com/package/webpack-aliyun-oss
https://www.npmjs.com/package/webpack-oss
https://github.com/gp5251/webpack-aliyun-oss
https://github.com/staven630/webpack-oss
refs
©xgqfrms 2012-2020
www.cnblogs.com 發布文章使用:只允許注冊用戶才可以訪問!