Dukuo
06/24/2018, 11:46 PMgraphql-import-loader
but whenever I try to build the app it just compiles all my .ts
files onlymedelman
06/25/2018, 12:09 AMmedelman
06/25/2018, 12:11 AMts-loader
Dukuo
06/25/2018, 12:12 AMDukuo
06/25/2018, 12:27 AM*.graphql
files to the dist
folder... Am I missing something here? @medelmanGomah
06/25/2018, 1:55 AM{ test: /\.graphql$/, exclude: /node_modules/, use: [{ loader: 'graphql-import-loader' }] },
Dukuo
06/25/2018, 2:52 AM'use strict';
var HappyPack = require('happypack');
var ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const path = require('path')
var fs = require('fs');
var nodeModules = {};
fs.readdirSync('node_modules')
.filter(function(x) {
return ['.bin'].indexOf(x) === -1;
})
.forEach(function(mod) {
nodeModules[mod] = 'commonjs ' + mod;
});
const nodeExternals = require('webpack-node-externals')
module.exports = {
context: __dirname, // to automatically find tsconfig.json
devtool: 'inline-source-map',
entry: './src/index.ts',
externals: [nodeExternals()],
output: {
filename: '[name].js',
libraryTarget: 'commonjs',
path: path.resolve(__dirname, 'dist'),
},
resolve: {
extensions: [ '.ts', '.js', '.graphql', '.json' ],
},
module: {
rules: [
{
test: /\.ts?$/,
exclude: /node_modules/,
use: [{ loader: 'happypack/loader?id=ts' }]
},
{
test: /\.graphql$/,
exclude: /node_modules/,
use: [{ loader: 'happypack/loader?id=graphql' }]
},
{
test: /\.json$/,
exclude: /node_modules/,
loader: 'json-loader'
},
]
},
plugins: [
new HappyPack({
id: 'ts',
threads: 2,
loaders: [
{
path: 'ts-loader',
query: { happyPackMode: true }
}
]
}),
new HappyPack({
id: 'graphql',
threads: 2,
loaders: [
{
path: 'graphql-import-loader'
}
]
}),
new ForkTsCheckerWebpackPlugin({ checkSyntacticErrors: true })
],
devServer: {
inline:true,
port: 4000,
contentBase: path.resolve(__dirname, 'dist')
},
target: 'node',
externals: nodeModules
};
Dukuo
06/25/2018, 2:53 AM