Skip to content

Instantly share code, notes, and snippets.

@gaetanlegac
Last active August 25, 2019 11:38
Show Gist options
  • Save gaetanlegac/f564bc91a5f43efc5a2565153969f102 to your computer and use it in GitHub Desktop.
Save gaetanlegac/f564bc91a5f43efc5a2565153969f102 to your computer and use it in GitHub Desktop.
// Quelques déclarations ...
export default {
context: ROOT_DIR,
name: 'server',
target: 'node',
mode: 'development',
entry: {
server: [
//'@babel/polyfill',
path.resolve(__dirname, '../serveur/index.ts')
],
},
output: {
publicPath: '/assets/',
pathinfo: isVerbose,
path: BUILD_DIR,
filename: '[name].js',
chunkFilename: 'chunks/[name].js',
libraryTarget: 'commonjs2',
},
resolve: {
modules: ['node_modules', 'src'],
extensions: [".mjs", '.ts', '.tsx', ".jsx", ".js", ".json"],
},
module: {
strictExportPresence: true,
rules: [
{
test: /\.(ts|js|jsx|tsx|mjs)$/,
include: [SRC_DIR],
loader: 'babel-loader',
options: {
// https://github.com/babel/babel-loader#options
cacheDirectory: false,
// https://babeljs.io/docs/usage/options/
babelrc: false,
configFile: false,
presets: [
// https://github.com/babel/babel/tree/master/packages/babel-preset-react
['@babel/preset-react', { development: isDebug }],
// https://github.com/babel/babel-preset-env
[
'@babel/preset-env',
{
targets: {
node: 12,
},
modules: false,
useBuiltIns: false,
debug: false,
},
],
// typescript
"@babel/typescript"
],
plugins: [
//'@babel/plugin-proposal-class-properties',
"@babel/proposal-object-rest-spread", // Pour typescript
'@babel/plugin-syntax-dynamic-import',
// Permet export X from Y
'@babel/plugin-proposal-export-default-from'
],
},
},
],
},
node: {
console: false,
global: false,
process: false,
Buffer: false,
__filename: false,
__dirname: false,
},
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment