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 发布文章使用:只允许注册用户才可以访问!