Commit e402eed7 authored by zsirfs's avatar zsirfs

init:初始化源码

parent 55eb05e5
{
"presets": ["@babel/preset-env"]
}
node_modules
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sentry Test</title>
</head>
<body>
<div id="app"></div>
</body>
</html>
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "sentry-test",
"version": "1.0.0",
"description": "sentry test",
"main": "index.js",
"dependencies": {
"@sentry/browser": "^5.12.1",
"lodash": "^4.17.15"
},
"devDependencies": {
"@babel/core": "^7.8.4",
"@babel/preset-env": "^7.8.4",
"babel-loader": "^8.0.6",
"html-webpack-plugin": "^3.2.0",
"webpack": "^4.41.6",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3"
},
"scripts": {
"start": "webpack-dev-server"
},
"repository": {
"type": "git",
"url": "http://gitlab2.dui88.com/zhenglongfan/sentry-test"
},
"keywords": [],
"author": "",
"license": "ISC"
}
import random from 'lodash/random';
import * as Sentry from '@sentry/browser';
Sentry.init({
dsn: 'https://c043ba03536a41bfb87d122984fa3e15@sentry.dui88.com/15',
});
const rd = random();
const appDom = document.getElementById('app');
appDom.innerHTML = `<button id="btn">点击记录 breadcrumb</button><button id="errorBtn">errorBtn</button>`;
document.getElementById('btn').onclick = () => {
Sentry.addBreadcrumb({
category: 'user.click',
message: '点击btn',
level: Sentry.Severity.Info,
data: { uid: 100 },
});
};
document.getElementById('errorBtn').onclick = () => {
const err = new Error('errorBtn 发生了错误');
Sentry.captureException(err);
};
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: path.resolve(__dirname, 'src/index.js'),
mode: 'development',
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
sourceMapFilename: '[name].js.map',
},
devtool: 'source-map',
devServer: {
hot: true,
host: 'localhost',
port: '8000',
open: true,
},
module: {
rules: [
{
test: /\.js$/,
use: [require.resolve('babel-loader')],
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'index.html'),
inject: true,
}),
],
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment