MOBILE-3565 core: Add webpack config aliases

main
Dani Palou 2020-10-05 17:24:36 +02:00
parent 300f017036
commit 50f44d8d9d
6 changed files with 97 additions and 9 deletions

View File

@ -12,7 +12,7 @@
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"builder": "@angular-builders/custom-webpack:browser",
"options": {
"outputPath": "www",
"index": "src/index.html",
@ -39,7 +39,10 @@
"input": "src/global.scss"
}
],
"scripts": []
"scripts": [],
"customWebpackConfig": {
"path": "./config/webpack.config.js"
}
},
"configurations": {
"production": {
@ -72,7 +75,7 @@
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"builder": "@angular-builders/custom-webpack:dev-server",
"options": {
"browserTarget": "app:build"
},

View File

@ -0,0 +1,31 @@
// (C) Copyright 2015 Moodle Pty Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
const { webpack } = require('webpack');
const { resolve } = require('path');
module.exports = (config, options, targetOptions) => {
config.resolve.alias['@'] = resolve('src');
config.resolve.alias['@addon'] = resolve('src/app/addon');
config.resolve.alias['@app'] = resolve('src/app');
config.resolve.alias['@classes'] = resolve('src/app/classes');
config.resolve.alias['@components'] = resolve('src/app/components');
config.resolve.alias['@core'] = resolve('src/app/core');
config.resolve.alias['@directives'] = resolve('src/app/directives');
config.resolve.alias['@pipes'] = resolve('src/app/pipes');
config.resolve.alias['@services'] = resolve('src/app/services');
config.resolve.alias['@singletons'] = resolve('src/app/singletons');
return config;
};

31
package-lock.json generated
View File

@ -1,9 +1,38 @@
{
"name": "moodlemobile",
"version": "0.0.1",
"version": "3.9.5",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@angular-builders/custom-webpack": {
"version": "10.0.1",
"resolved": "https://registry.npmjs.org/@angular-builders/custom-webpack/-/custom-webpack-10.0.1.tgz",
"integrity": "sha512-YDy5zEKVwXdoXLjmbsY6kGaEbmunQxaPipxrwLUc9hIjRLU2WcrX9vopf1R9Pgj4POad73IPBNGu+ibqNRFIEQ==",
"dev": true,
"requires": {
"@angular-devkit/architect": ">=0.1000.0 < 0.1100.0",
"@angular-devkit/build-angular": ">=0.1000.0 < 0.1100.0",
"@angular-devkit/core": "^10.0.0",
"lodash": "^4.17.15",
"ts-node": "^9.0.0",
"webpack-merge": "^4.2.2"
},
"dependencies": {
"ts-node": {
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.0.0.tgz",
"integrity": "sha512-/TqB4SnererCDR/vb4S/QvSZvzQMJN8daAslg7MeaiHvD8rDZsSfXmNeNumyZZzMned72Xoq/isQljYSt8Ynfg==",
"dev": true,
"requires": {
"arg": "^4.1.0",
"diff": "^4.0.1",
"make-error": "^1.1.1",
"source-map-support": "^0.5.17",
"yn": "3.1.1"
}
}
}
},
"@angular-devkit/architect": {
"version": "0.1000.8",
"resolved": "https://registry.npmjs.org/@angular-devkit/architect/-/architect-0.1000.8.tgz",

View File

@ -41,15 +41,16 @@
"zone.js": "~0.10.3"
},
"devDependencies": {
"@angular-builders/custom-webpack": "^10.0.1",
"@angular-devkit/build-angular": "~0.1000.0",
"@angular/cli": "~10.0.5",
"@angular/compiler": "~10.0.0",
"@angular/compiler-cli": "~10.0.0",
"@angular/language-service": "~10.0.0",
"@ionic/angular-toolkit": "^2.3.0",
"@types/node": "^12.11.1",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~5.0.0",

View File

@ -2,7 +2,19 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
"types": [],
"paths": {
"@/*": ["*"],
"@addon/*": ["app/addon/*"],
"@app/*": ["app/*"],
"@classes/*": ["app/classes/*"],
"@components/*": ["app/components/*"],
"@core/*": ["app/core/*"],
"@directives/*": ["app/directives/*"],
"@pipes/*": ["app/pipes/*"],
"@services/*": ["app/services/*"],
"@singletons/*": ["app/singletons/*"]
}
},
"files": [
"src/main.ts",

View File

@ -1,7 +1,7 @@
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"baseUrl": "src",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
@ -14,10 +14,22 @@
"lib": [
"es2018",
"dom"
]
],
"paths": {
"@/*": ["*"],
"@addon/*": ["app/addon/*"],
"@app/*": ["app/*"],
"@classes/*": ["app/classes/*"],
"@components/*": ["app/components/*"],
"@core/*": ["app/core/*"],
"@directives/*": ["app/directives/*"],
"@pipes/*": ["app/pipes/*"],
"@services/*": ["app/services/*"],
"@singletons/*": ["app/singletons/*"]
}
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
}
}
}