Skip to content
This repository was archived by the owner on Dec 1, 2019. It is now read-only.

Commit ca86fd7

Browse files
author
Stanislav Panferov
committed
feat(*): add alias example
1 parent c3ae47c commit ca86fd7

File tree

4 files changed

+47
-0
lines changed

4 files changed

+47
-0
lines changed

examples/alias/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { Constants } from 'common/util/constants';
2+
3+
console.log(Constants.Test);

examples/alias/package.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "tsjsx-example",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "webpack.config.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"author": "",
10+
"license": "MIT",
11+
"devDependencies": {
12+
"node-libs-browser": "^0.5.0",
13+
"webpack": "^1.9.10"
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export enum Constants {
2+
Test = 1
3+
}

examples/alias/webpack.config.js

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
var ExtractTextPlugin = require("extract-text-webpack-plugin")
2+
3+
module.exports = {
4+
resolve: {
5+
extensions: ['', '.ts', '.js'],
6+
alias: {
7+
common: './src/common/lib'
8+
}
9+
},
10+
devtool: 'source-map',
11+
module: {
12+
loaders: [
13+
{
14+
test: /\.ts$/,
15+
loader: '../../dist/index.js?module=common&rewriteImports=common'
16+
}
17+
]
18+
},
19+
entry: {
20+
index: ['./index.ts']
21+
},
22+
output: {
23+
path: './dist',
24+
filename: './[name].js'
25+
}
26+
};

0 commit comments

Comments
 (0)