Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion build_scripts/webpack-plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ module.exports = () => {
'!unusualLineTerminators',
'!viewportSemanticTokens'
],
languages: []
languages: [],
filename: '[name]-[hash].worker.js'
})
]

Expand Down
31 changes: 23 additions & 8 deletions build_scripts/webpack-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ const createStyledComponentsTransformer = require('typescript-plugin-styled-comp
.default
const styledComponentsTransformer = createStyledComponentsTransformer()

const tsLoaderOptions = {
transpileOnly: true,
getCustomTransformers: () => ({
before: [...(helpers.isProduction ? [] : [styledComponentsTransformer])]
})
}

module.exports = [
{
test: /\.(ts|tsx)?$/,
use: {
loader: 'ts-loader',
options: {
transpileOnly: true,
getCustomTransformers: () => ({
before: [
...(helpers.isProduction ? [] : [styledComponentsTransformer])
]
})
}
options: tsLoaderOptions
},
include: [path.resolve('src')],
exclude: /node_modules/
Expand Down Expand Up @@ -138,5 +138,20 @@ module.exports = [
{
test: /\.html?$/,
use: ['html-loader']
},
{
test: /boltWorker\.ts/,
use: [
{
loader: 'worker-loader',
options: {
name: 'bolt-worker-[hash].js'
}
},
{
loader: 'ts-loader',
options: tsLoaderOptions
}
]
}
]
8 changes: 1 addition & 7 deletions build_scripts/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = {
entry: [path.resolve(helpers.browserPath, 'index.tsx')],
output: {
filename: 'app-[hash].js',
chunkFilename: '[name].chunkhash.bundle.js',
chunkFilename: '[name]-[hash].bundle.js',
publicPath: '',
path: helpers.buildPath,
globalObject: 'this'
Expand Down Expand Up @@ -89,12 +89,6 @@ module.exports = {
name: 'neo4j-driver',
chunks: 'all',
enforce: true
},
worker: {
test: /boltWorker/,
name: 'worker',
chunks: 'all',
enforce: true
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/browser/custom.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,11 @@ declare module 'monaco-editor/esm/vs/base/parts/quickinput/browser/quickInputLis
}
}
}

declare module 'shared/services/bolt/boltWorker' {
class WebpackWorker extends Worker {
constructor()
}

export default WebpackWorker
}
3 changes: 1 addition & 2 deletions src/shared/services/bolt/bolt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ import {
import { NATIVE } from 'services/bolt/boltHelpers'
import { setupBoltWorker, addTypesAsField } from './setup-bolt-worker'

// @ts-expect-error ts-migrate(2307) FIXME: Cannot find module 'worker-loader?inline!./boltWor... Remove this comment to see the full error message
import BoltWorkerModule from 'worker-loader?inline!./boltWorker'
import BoltWorkerModule from 'shared/services/bolt/boltWorker'
import { Connection } from 'shared/modules/connections/connectionsDuck'

let connectionProperties: {} | null = null
Expand Down