mirror of
https://github.com/marktext/marktext.git
synced 2025-05-03 04:51:28 +08:00
Add production source maps (#610)
* Add production source maps * Increase mocha timeout
This commit is contained in:
parent
9e32c4a0ca
commit
a2a0363541
@ -11,6 +11,7 @@ const isOfficialRelease = !!process.env.MARKTEXT_IS_OFFICIAL_RELEASE
|
||||
|
||||
const mainConfig = {
|
||||
mode: 'development',
|
||||
devtool: '#cheap-module-eval-source-map',
|
||||
entry: {
|
||||
main: path.join(__dirname, '../src/main/index.js')
|
||||
},
|
||||
@ -26,7 +27,8 @@ const mainConfig = {
|
||||
use: {
|
||||
loader: 'eslint-loader',
|
||||
options: {
|
||||
formatter: require('eslint-friendly-formatter')
|
||||
formatter: require('eslint-friendly-formatter'),
|
||||
failOnError: true
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -74,6 +76,7 @@ if (!proMode) {
|
||||
* Adjust mainConfig for production settings
|
||||
*/
|
||||
if (proMode) {
|
||||
mainConfig.devtool = '#nosources-source-map'
|
||||
mainConfig.mode = 'production'
|
||||
mainConfig.plugins.push(
|
||||
// new BabiliWebpackPlugin()
|
||||
|
@ -40,7 +40,8 @@ const rendererConfig = {
|
||||
use: {
|
||||
loader: 'eslint-loader',
|
||||
options: {
|
||||
formatter: require('eslint-friendly-formatter')
|
||||
formatter: require('eslint-friendly-formatter'),
|
||||
failOnError: true
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -83,7 +84,10 @@ const rendererConfig = {
|
||||
{
|
||||
test: /\.vue$/,
|
||||
use: {
|
||||
loader: 'vue-loader'
|
||||
loader: 'vue-loader',
|
||||
options: {
|
||||
sourceMap: true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -130,8 +134,8 @@ const rendererConfig = {
|
||||
]
|
||||
},
|
||||
node: {
|
||||
__dirname: process.env.NODE_ENV !== 'production',
|
||||
__filename: process.env.NODE_ENV !== 'production'
|
||||
__dirname: !proMode,
|
||||
__filename: !proMode
|
||||
},
|
||||
plugins: [
|
||||
new SpritePlugin(),
|
||||
@ -169,7 +173,7 @@ const rendererConfig = {
|
||||
/**
|
||||
* Adjust rendererConfig for development settings
|
||||
*/
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (!proMode) {
|
||||
rendererConfig.plugins.push(
|
||||
new webpack.DefinePlugin({
|
||||
'__static': `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"`
|
||||
@ -188,7 +192,7 @@ if (process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'test') {
|
||||
* Adjust rendererConfig for production settings
|
||||
*/
|
||||
if (proMode) {
|
||||
rendererConfig.devtool = ''
|
||||
rendererConfig.devtool = '#nosources-source-map'
|
||||
rendererConfig.mode = 'production'
|
||||
rendererConfig.plugins.push(
|
||||
new MiniCssExtractPlugin({
|
||||
|
@ -71,7 +71,10 @@ const webConfig = {
|
||||
{
|
||||
test: /\.vue$/,
|
||||
use: {
|
||||
loader: 'vue-loader'
|
||||
loader: 'vue-loader',
|
||||
options: {
|
||||
sourceMap: true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -146,7 +149,7 @@ const webConfig = {
|
||||
* Adjust webConfig for production settings
|
||||
*/
|
||||
if (proMode) {
|
||||
webConfig.devtool = ''
|
||||
webConfig.devtool = '#nosources-source-map'
|
||||
webConfig.mode ='production'
|
||||
|
||||
webConfig.plugins.push(
|
||||
|
@ -16,7 +16,7 @@
|
||||
"build:dev": "node .electron-vue/build.js",
|
||||
"build:web": "cross-env BUILD_TARGET=web node .electron-vue/build.js",
|
||||
"dev": "node .electron-vue/dev-runner.js",
|
||||
"e2e": "npm run pack && mocha test/e2e",
|
||||
"e2e": "npm run pack && mocha --timeout 10000 test/e2e",
|
||||
"lint": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter src test",
|
||||
"lint:fix": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter --fix src test",
|
||||
"pack": "npm run pack:main && npm run pack:renderer",
|
||||
@ -155,6 +155,7 @@
|
||||
"snabbdom": "^0.7.2",
|
||||
"snabbdom-to-html": "^5.1.1",
|
||||
"snapsvg": "^0.5.1",
|
||||
"source-map-support": "^0.5.9",
|
||||
"turndown": "^5.0.1",
|
||||
"turndown-plugin-gfm": "^1.0.2",
|
||||
"underscore": "^1.9.1",
|
||||
|
@ -12,6 +12,13 @@ import services from './services'
|
||||
import './assets/styles/index.css'
|
||||
import './assets/styles/printService.css'
|
||||
|
||||
import sourceMapSupport from 'source-map-support'
|
||||
sourceMapSupport.install({
|
||||
environment: 'node',
|
||||
handleUncaughtExceptions: false,
|
||||
hookRequire: false
|
||||
})
|
||||
|
||||
window.addEventListener('error', event => {
|
||||
const { message, name, stack } = event.error
|
||||
const copy = {
|
||||
|
Loading…
Reference in New Issue
Block a user