Skip to content

Commit 2ec0492

Browse files
committed
Initial commit of fixed path mappings for awesome-typescript-loader v1.1.1. We could use it across the board. Maybe.
1 parent c7ca12e commit 2ec0492

File tree

4 files changed

+21
-13
lines changed

4 files changed

+21
-13
lines changed

addon/ng2/models/webpack-build-common.ts

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
11
import * as webpack from 'webpack';
2+
import {PathsPlugin, LoaderConfig} from '../utilities/ts-path-mappings-webpack-plugin';
23

34
const path = require('path');
45
const ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin;
56
const CopyWebpackPlugin = require('copy-webpack-plugin');
67
const HtmlWebpackPlugin = require('html-webpack-plugin');
78

89
export const getWebpackCommonConfig = function(projectRoot: string) {
10+
const awesomeTypescriptLoaderConfig: LoaderConfig | any = {
11+
useWebpackText: true,
12+
useForkChecker: true,
13+
tsconfig: path.resolve(projectRoot, './src/tsconfig.json')
14+
}
15+
916
return {
1017
devtool: 'inline-source-map',
1118
resolve: {
1219
extensions: ['', '.ts', '.js'],
13-
root: path.resolve(projectRoot, './src')
20+
plugins: [
21+
new PathsPlugin(awesomeTypescriptLoaderConfig)
22+
]
1423
},
1524
context: path.resolve(__dirname, './'),
1625
entry: {
@@ -39,11 +48,7 @@ export const getWebpackCommonConfig = function(projectRoot: string) {
3948
loaders: [
4049
{
4150
loader: 'awesome-typescript-loader',
42-
query: {
43-
useWebpackText: true,
44-
useForkChecker: true,
45-
tsconfig: path.resolve(projectRoot, './src/tsconfig.json')
46-
}
51+
query: awesomeTypescriptLoaderConfig
4752
},
4853
{
4954
loader: 'angular2-template-loader'

addon/ng2/tasks/build-webpack-watch.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import {NgCliWebpackConfig} from '../models/webpack-config'
22
import {webpackOutputOptions} from '../models/';
3-
43
import {ServeTaskOptions} from '../commands/serve';
4+
import * as rimraf from 'rimraf';
5+
import * as path from 'path';
56

6-
var Task = require('ember-cli/lib/models/task');
7+
var Task = require('ember-cli/lib/models/task');
78
const webpack = require('webpack');
89
const ProgressPlugin = require('webpack/lib/ProgressPlugin');
9-
const rimraf = require('rimraf');
10-
const path = require('path');
10+
1111

1212
let lastHash: any = null;
1313

addon/ng2/tasks/build-webpack.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import {ServeTaskOptions} from '../commands/serve';
22
import {NgCliWebpackConfig} from '../models/webpack-config'
33
import {webpackOutputOptions} from '../models/'
4+
import * as rimraf from 'rimraf';
5+
import * as path from 'path';
46

57
// Configure build and output;
68
var Task = require('ember-cli/lib/models/task');
79
const webpack = require('webpack');
8-
const rimraf = require('rimraf');
9-
const path = require('path');
1010

11-
let lastHash = null;
11+
let lastHash: any = null;
1212

1313
module.exports = Task.extend({
1414
// Options: String outputPath

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
"homepage": "https://github.com/angular/angular-cli",
3232
"dependencies": {
3333
"@angular/compiler-cli": "^0.2.0",
34+
"@types/lodash": "^4.0.25-alpha",
35+
"@types/rimraf": "0.0.25-alpha",
3436
"@types/webpack": "^1.12.22-alpha",
3537
"angular2-template-loader": "^0.4.0",
3638
"awesome-typescript-loader": "1.1.1",
@@ -41,6 +43,7 @@
4143
"css-loader": "^0.23.1",
4244
"ember-cli": "2.5.0",
4345
"ember-cli-string-utils": "^1.0.0",
46+
"enhanced-resolve": "^2.2.2",
4447
"exit": "^0.1.2",
4548
"exports-loader": "^0.6.3",
4649
"expose-loader": "^0.7.1",

0 commit comments

Comments
 (0)