Skip to content

Commit 943d233

Browse files
feat: adding settings for using @src as an import alias
1 parent 9a1e311 commit 943d233

File tree

9 files changed

+13
-1
lines changed

9 files changed

+13
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openedx/frontend-base",
3-
"version": "1.0.0-alpha.7",
3+
"version": "1.0.0-alpha.8",
44
"description": "Build tools, setup and config for frontend apps",
55
"publishConfig": {
66
"access": "public"

runtime/jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module.exports = {
77
'\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir/__mocks__/file.js',
88
'\\.(css|scss)$': require.resolve('identity-obj-proxy'),
99
'site.config': '<rootDir>/site.config.test.tsx',
10+
'^@src/(.*)$': '<rootDir>/src/$1',
1011
},
1112
testEnvironment: 'jsdom',
1213
testEnvironmentOptions: {

shell/jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module.exports = {
77
'\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/__mocks__/file.js',
88
'\\.(css|scss)$': require.resolve('identity-obj-proxy'),
99
'site.config': '<rootDir>/site.config.test.tsx',
10+
'^@src/(.*)$': '<rootDir>/src/$1',
1011
},
1112
testEnvironment: 'jsdom',
1213
testEnvironmentOptions: {

tools/jest/jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module.exports = {
99
moduleNameMapper: {
1010
'\\.(css|scss)$': require.resolve('identity-obj-proxy'),
1111
'site.config': path.resolve(process.cwd(), './site.config.test.tsx'),
12+
'^@src/(.*)$': '<rootDir>/src/$1',
1213
},
1314
collectCoverageFrom: [
1415
'src/**/*.{js,jsx,ts,tsx}',

tools/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
"noEmit": false,
77
"allowJs": true,
88
"resolveJsonModule": true,
9+
"paths": {
10+
"@src/*": ["./src/*"]
11+
}
912
},
1013
"include": [
1114
"babel/**/*",

tools/webpack/webpack.config.build.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const config: Configuration = {
3636
alias: {
3737
...aliases,
3838
'site.config': resolvedSiteConfigPath,
39+
'@src': path.resolve(process.cwd(), 'src'),
3940
},
4041
extensions: ['.js', '.jsx', '.ts', '.tsx'],
4142
},

tools/webpack/webpack.config.dev.shell.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const config: Configuration = {
3434
alias: {
3535
...aliases,
3636
'site.config': resolvedSiteConfigPath,
37+
'@src': path.resolve(process.cwd(), 'src'),
3738
},
3839
extensions: ['.js', '.jsx', '.ts', '.tsx'],
3940
},

tools/webpack/webpack.config.dev.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const config: Configuration = {
3333
alias: {
3434
...aliases,
3535
'site.config': resolvedSiteConfigPath,
36+
'@src': path.resolve(process.cwd(), 'src'),
3637
},
3738
extensions: ['.js', '.jsx', '.ts', '.tsx'],
3839
},

tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
"compilerOptions": {
44
"rootDir": ".",
55
"outDir": "dist",
6+
"paths": {
7+
"@src/*": ["./src/*"]
8+
}
69
},
710
"include": [
811
"runtime/**/*",

0 commit comments

Comments
 (0)