Add development build support for schema sub-paths
- Add webpack NormalModuleReplacementPlugin to resolve sub-paths from source - Add TypeScript paths mappings for monorepo type-checking - Add Jest moduleNameMapper for test resolution
This commit is contained in:
@@ -67,6 +67,8 @@ module.exports = {
|
||||
// near-membrane-dom won't work in a nodejs environment.
|
||||
'@locker/near-membrane-dom': '<rootDir>/public/test/mocks/nearMembraneDom.ts',
|
||||
'^@grafana/schema/dist/esm/(.*)$': '<rootDir>/packages/grafana-schema/src/$1',
|
||||
'^@grafana/schema/dashboard/v0$': '<rootDir>/packages/grafana-schema/src/schema/dashboard/v0/index',
|
||||
'^@grafana/schema/dashboard/v2beta1$': '<rootDir>/packages/grafana-schema/src/schema/dashboard/v2beta1/index',
|
||||
// prevent systemjs amd extra from breaking tests.
|
||||
'systemjs/dist/extras/amd': '<rootDir>/public/test/mocks/systemjsAMDExtra.ts',
|
||||
'@bsull/augurs': '<rootDir>/public/test/mocks/augurs.ts',
|
||||
|
||||
@@ -65,6 +65,12 @@ module.exports = {
|
||||
new webpack.NormalModuleReplacementPlugin(/^@grafana\/schema\/dist\/esm\/(.*)$/, (resource) => {
|
||||
resource.request = resource.request.replace('@grafana/schema/dist/esm', '@grafana/schema/src');
|
||||
}),
|
||||
new webpack.NormalModuleReplacementPlugin(/^@grafana\/schema\/dashboard\/v0$/, (resource) => {
|
||||
resource.request = '@grafana/schema/src/schema/dashboard/v0/index';
|
||||
}),
|
||||
new webpack.NormalModuleReplacementPlugin(/^@grafana\/schema\/dashboard\/v2beta1$/, (resource) => {
|
||||
resource.request = '@grafana/schema/src/schema/dashboard/v2beta1/index';
|
||||
}),
|
||||
new CorsWorkerPlugin(),
|
||||
new webpack.ProvidePlugin({
|
||||
Buffer: ['buffer', 'Buffer'],
|
||||
|
||||
+3
-1
@@ -14,7 +14,9 @@
|
||||
"moduleResolution": "bundler",
|
||||
"tsBuildInfoFile": "./tsconfig.tsbuildinfo",
|
||||
"paths": {
|
||||
"@grafana/schema/dist/esm/*": ["../packages/grafana-schema/src/*"]
|
||||
"@grafana/schema/dist/esm/*": ["../packages/grafana-schema/src/*"],
|
||||
"@grafana/schema/dashboard/v0": ["../packages/grafana-schema/src/schema/dashboard/v0/index"],
|
||||
"@grafana/schema/dashboard/v2beta1": ["../packages/grafana-schema/src/schema/dashboard/v2beta1/index"]
|
||||
}
|
||||
},
|
||||
"ts-node": {
|
||||
|
||||
Reference in New Issue
Block a user