Skip to content

Commit

Permalink
unify desktop and web extension
Browse files Browse the repository at this point in the history
  • Loading branch information
floooh committed Nov 22, 2023
1 parent e471a28 commit 4d0cff0
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 24 deletions.
15 changes: 1 addition & 14 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,7 @@
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": [
"${workspaceFolder}/out/test/**/*.js"
"${workspaceFolder}/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
}
Expand Down
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"tasks": [
{
"type": "npm",
"script": "watch",
"script": "compile-dev",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
Expand Down
7 changes: 7 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.vscode
node_modules
out/
src/
*.js.map
tsconfig.json
webpack.config.js
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"activationEvents": [
"workspaceContains:kcide.project.json"
],
"main": "./out/extension.js",
"main": "./dist/web/extension.js",
"browser": "./dist/web/extension.js",
"preview": true,
"contributes": {
Expand Down Expand Up @@ -213,14 +213,12 @@
]
},
"scripts": {
"vscode:prepublish": "npm run clean && npm run compile && npm run compile-web",
"vscode:prepublish": "npm run clean && npm run compile",
"clean": "rimraf out dist",
"compile": "tsc -p ./",
"compile-web": "webpack",
"watch": "tsc -watch -p ./",
"compile": "webpack --mode production",
"compile-dev": "webpack --mode development",
"pretest": "npm run compile && npm run lint",
"lint": "eslint src --ext ts && tsc --noEmit",
"test": "node ./out/test/runTest.js"
"lint": "eslint src --ext ts && tsc --noEmit"
},
"devDependencies": {
"@types/mocha": "^10.0.3",
Expand Down
4 changes: 2 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const webExtensionConfig = {
filename: '[name].js',
path: path.join(__dirname, './dist/web'),
libraryTarget: 'commonjs',
devtoolModuleFilenameTemplate: '../../[resource-path]'
devtoolModuleFilenameTemplate: 'file:///[absolute-resource-path]'
},
resolve: {
mainFields: ['browser', 'module', 'main'], // look for `browser` entry point in imported node modules
Expand Down Expand Up @@ -54,6 +54,6 @@ const webExtensionConfig = {
performance: {
hints: false
},
devtool: 'nosources-source-map' // create a source map that points to the original source file
devtool: 'source-map' // create a source map that points to the original source file
};
module.exports = [webExtensionConfig];

0 comments on commit 4d0cff0

Please sign in to comment.