Skip to content

Commit

Permalink
Use awesome typescript loader for caching benefits
Browse files Browse the repository at this point in the history
  • Loading branch information
niik committed Apr 18, 2017
1 parent c0eab89 commit a89fbe4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 38 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules/
npm-debug.log
app/node_modules/
.DS_Store
.awcache
53 changes: 15 additions & 38 deletions app/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const replacements = {
}

const commonConfig = {
externals: [
externals: [
'electron',
'net',
'remote',
Expand All @@ -34,6 +34,20 @@ const commonConfig = {
},
module: {
rules: [
{
test: /\.tsx?$/,
include: path.resolve(__dirname, 'src'),
use: [
{
loader: 'awesome-typescript-loader',
options: {
useBabel: true,
useCache: true,
},
}
],
exclude: /node_modules/,
},
{
test: /\.node$/,
use: [
Expand All @@ -48,7 +62,6 @@ const commonConfig = {
resolve: {
extensions: [ '.js', '.ts', '.tsx' ],
modules: [ path.resolve(__dirname, 'node_modules/') ],
mainFields: ['webpack', 'browser', 'web', 'browserify', ['jam', 'main'], 'main']
},
node: {
__dirname: false,
Expand All @@ -59,29 +72,13 @@ const commonConfig = {
const mainConfig = merge({}, commonConfig, {
entry: { main: path.resolve(__dirname, 'src/main-process/main') },
target: 'electron-main',
module: {
rules: [
{
test: /\.ts$/,
include: path.resolve(__dirname, 'src'),
use: 'ts-loader',
exclude: /node_modules/,
}
]
},
})

const rendererConfig = merge({}, commonConfig, {
entry: { renderer: path.resolve(__dirname, 'src/ui/index') },
target: 'electron-renderer',
module: {
rules: [
{
test: /\.tsx?$/,
include: path.resolve(__dirname, 'src'),
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.(jpe?g|png|gif|ico)$/,
use: ['file?name=[path][name].[ext]']
Expand All @@ -99,16 +96,6 @@ const rendererConfig = merge({}, commonConfig, {
const sharedConfig = merge({}, commonConfig, {
entry: { shared: path.resolve(__dirname, 'src/shared-process/index') },
target: 'electron-renderer',
module: {
rules: [
{
test: /\.ts$/,
include: path.resolve(__dirname, 'src'),
use: 'ts-loader',
exclude: /node_modules/,
}
]
},
plugins: [
new HtmlWebpackPlugin({
'filename': 'shared.html',
Expand All @@ -120,16 +107,6 @@ const sharedConfig = merge({}, commonConfig, {
const askPassConfig = merge({}, commonConfig, {
entry: { 'ask-pass': path.resolve(__dirname, 'src/ask-pass/main') },
target: 'node',
module: {
rules: [
{
test: /\.ts$/,
include: path.resolve(__dirname, 'src'),
use: 'ts-loader',
exclude: /node_modules/,
}
]
},
})

module.exports = {
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
},
"dependencies": {
"@niik/tslint-microsoft-contrib": "^2.0.14",
"awesome-typescript-loader": "^3.1.2",
"aws-sdk": "^2.23.0",
"babel-core": "^6.24.1",
"chai": "^3.5.0",
"chai-as-promised": "^6.0.0",
"chai-datetime": "^1.4.1",
Expand Down

0 comments on commit a89fbe4

Please sign in to comment.