Skip to content

Instantly share code, notes, and snippets.

@mosluce
Created May 7, 2021 17:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mosluce/64320bf1d4056b13be36f8055a9232a8 to your computer and use it in GitHub Desktop.
Save mosluce/64320bf1d4056b13be36f8055a9232a8 to your computer and use it in GitHub Desktop.
webpack + babel-loader + vscode
{
"rules": {},
"env": {
"es6": true,
"browser": true,
"node": true
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"extends": ["eslint:recommended", "plugin:prettier/recommended"],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
}
}
{
"presets": [["@babel/preset-env", { "targets": { "node": "12" } }]],
"sourceMaps": "inline"
}
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch via NPM",
"request": "launch",
"runtimeArgs": ["run", "start:dev"],
"runtimeExecutable": "npm",
"skipFiles": ["<node_internals>/**"],
"type": "pwa-node"
}
]
}
{
"name": "klcc-api-core",
"version": "1.0.0",
"main": "index.js",
"author": "mosluce",
"license": "MIT",
"dependencies": {
"babel-loader": "^8.2.2",
"express": "^4.17.1",
"parse-server": "^2.8.11-upsert-db-cors"
},
"scripts": {
"build": "webpack",
"start:dev": "concurrently \"webpack --watch\" \"nodemon node dist/index.js\"",
"lint": "eslint",
"test": "jest"
},
"engines": {
"node": ">=12"
},
"devDependencies": {
"@babel/cli": "^7.13.16",
"@babel/core": "^7.14.0",
"@babel/node": "^7.13.13",
"@babel/preset-env": "^7.14.1",
"@types/parse": "^2.18.6",
"babel-jest": "^26.6.3",
"eslint": "^7.25.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"jest": "^26.6.3",
"nodemon": "^2.0.7",
"prettier": "^2.2.1",
"webpack": "^5.36.2",
"webpack-cli": "^4.7.0",
"webpack-node-externals": "^3.0.0",
"concurrently": "6.0.2"
}
}
const path = require('path');
const nodeExternal = require('webpack-node-externals');
const configs = {
entry: {
index: './src/index.js',
},
target: 'node',
mode: 'development',
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
},
module: {
rules: [
{
test: /\.m?js$/,
exclude: /node_modules/,
use: 'babel-loader',
},
],
},
externals: [nodeExternal()],
devtool: 'eval-source-map',
};
module.exports = configs;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment