| 1 |
/* ************************************************************************ */ |
| 2 |
/* */ |
| 3 |
/* This file is part of Frama-C. */ |
| 4 |
/* */ |
| 5 |
/* Copyright (C) 2007-2022 */ |
| 6 |
/* CEA (Commissariat à l'énergie atomique et aux énergies */ |
| 7 |
/* alternatives) */ |
| 8 |
/* */ |
| 9 |
/* you can redistribute it and/or modify it under the terms of the GNU */ |
| 10 |
/* Lesser General Public License as published by the Free Software */ |
| 11 |
/* Foundation, version 2.1. */ |
| 12 |
/* */ |
| 13 |
/* It is distributed in the hope that it will be useful, */ |
| 14 |
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ |
| 15 |
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ |
| 16 |
/* GNU Lesser General Public License for more details. */ |
| 17 |
/* */ |
| 18 |
/* See the GNU Lesser General Public License version 2.1 */ |
| 19 |
/* for more details (enclosed in the file licenses/LGPLv2.1). */ |
| 20 |
/* */ |
| 21 |
/* ************************************************************************ */ |
| 22 |
|
| 23 |
// -------------------------------------------------------------------------- |
| 24 |
// --- Webpack extension for electron main-process |
| 25 |
// -------------------------------------------------------------------------- |
| 26 |
|
| 27 |
/* |
| 28 |
Template of ./webpack.main.js from $(DOME)/template/webpack.main.js |
| 29 |
|
| 30 |
This webpack definitions will be merged into electron-webpack |
| 31 |
ones thanks to electron-webpack.json configuration file. |
| 32 |
|
| 33 |
You may extend it with your own additions. |
| 34 |
*/ |
| 35 |
|
| 36 |
const path = require('path'); |
| 37 |
const DOME = process.env.DOME || path.resolve(__dirname , 'dome'); |
| 38 |
const ENV = process.env.DOME_ENV ; |
| 39 |
|
| 40 |
// Do not use electron-devtools-installer in production mode |
| 41 |
function domeDevtools() { |
| 42 |
switch(ENV) { |
| 43 |
case 'dev': |
| 44 |
return 'electron-devtools-installer'; |
| 45 |
default: |
| 46 |
return path.resolve( DOME , 'misc/devtools.js' ); |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
// -------------------------------------------------------------------------- |
| 51 |
|
| 52 |
module.exports = { |
| 53 |
module: { |
| 54 |
rules: [ |
| 55 |
{ test: /\.(ts|js)x?$/, use: [ 'babel-loader' ], exclude: /node_modules/ } |
| 56 |
], |
| 57 |
strictExportPresence: true |
| 58 |
}, |
| 59 |
resolve: { |
| 60 |
extensions: ['.ts', '.tsx', '.js', 'jsx', '.json'], |
| 61 |
alias: { |
| 62 |
'dome$': path.resolve( DOME , 'main/dome.ts' ), |
| 63 |
'dome/system$': path.resolve( DOME , 'misc/system.ts' ), |
| 64 |
'dome/devtools': domeDevtools() |
| 65 |
} |
| 66 |
} |
| 67 |
} ; |
| 68 |
|
| 69 |
// -------------------------------------------------------------------------- |