Skip to content

Instantly share code, notes, and snippets.

@moshfeu
Last active February 5, 2019 20:29
Show Gist options
  • Save moshfeu/6b7b6251c09a0d72761a9641d24a9693 to your computer and use it in GitHub Desktop.
Save moshfeu/6b7b6251c09a0d72761a9641d24a9693 to your computer and use it in GitHub Desktop.
Electron post - step 2
const { DefinePlugin } = require('webpack');
module.exports = {
entry: './src/components/main.tsx',
module: {
rules: [
{
test: /\.ts|.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.scss$/,
use: [
"style-loader", // creates style nodes from JS strings
"css-loader", // translates CSS into CommonJS
"sass-loader", // compiles Sass to CSS, using Node Sass by default
"postcss-loader"
],
exclude: /node_modules/
},
{
test: /\.(gif|png|jpe?g)$/i,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'resources/',
}
},
],
exclude: /node_modules/
},
{
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
use: [{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'resources/fonts/'
}
}]
}
]
},
watch: true,
watchOptions: {
poll: true
},
resolve: {
modules: ['node_modules'],
extensions: [ '.ts', '.tsx', '.js', '.json' ]
},
output: {
filename: 'resources/app.bundle.js',
sourceMapFilename: 'resources/app.bundle.js.map',
path: __dirname
},
mode: 'development',
devtool : 'cheap-source-map',
target: 'node',
plugins: [
new DefinePlugin({
'process.env.FLUENTFFMPEG_COV': false
}),
{
apply: compiler => {
compiler.hooks.beforeCompile.tap('clearConsole', compilation => {
process.stdout.write('\033c');
});
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment