Skip to content

Commit

Permalink
fix(dev): do not use webpack for development mode
Browse files Browse the repository at this point in the history
We use nodemon and babel-node concurrently instead
  • Loading branch information
Albert Alises committed Oct 12, 2020
1 parent 5c6b89b commit 6c989dc
Show file tree
Hide file tree
Showing 6 changed files with 289 additions and 599 deletions.
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"description": "Barcelona Urban Mobility GraphQL API",
"main": "dist/server.js",
"scripts": {
"build:prod": "webpack --config webpack.production.js",
"build:dev": "webpack --config webpack.development.js",
"build": "webpack --config webpack.config.js",
"start": "node dist/server",
"dev": "concurrently --kill-others \"tsc -w\" \"nodemon --exec babel-node dist/index\"",
"typecheck": "tsc --noEmit",
"lint": "eslint",
"schema": "graphql-codegen",
Expand All @@ -30,20 +30,21 @@
"@typescript-eslint/parser": "^4.4.0",
"apollo-datasource-rest": "^0.9.4",
"babel-jest": "^26.5.2",
"babel-node": "^0.0.1-security",
"clean-webpack-plugin": "^3.0.0",
"concurrently": "^5.3.0",
"eslint": "^7.10.0",
"eslint-config-prettier": "^6.12.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.4",
"husky": "^4.3.0",
"jest": "^26.5.3",
"nodemon": "^2.0.4",
"prettier": "^2.1.2",
"ts-loader": "^8.0.4",
"typescript": "^4.0.3",
"webpack": "^4.44.2",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "3.11.0",
"webpack-merge": "^5.1.4",
"webpack-node-externals": "^2.5.2"
},
"dependencies": {
Expand Down
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const server: ApolloServer = new ApolloServer({
}),
});

// The `listen` method launches a web server.
server.listen(process.env.PORT || 4000).then(({ url }) => {
console.log(`🚀 Server ready at ${url}`);
});
Expand Down
8 changes: 8 additions & 0 deletions webpack.common.js → webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const nodeExternals = require("webpack-node-externals");

const path = require("path");

module.exports = {
entry: [path.join(__dirname, "src/index.ts")],
externals: [nodeExternals({})],
mode: "production",
plugins: [new CleanWebpackPlugin()],
module: {
rules: [
{
Expand Down
20 changes: 0 additions & 20 deletions webpack.development.js

This file was deleted.

14 changes: 0 additions & 14 deletions webpack.production.js

This file was deleted.

Loading

0 comments on commit 6c989dc

Please # to comment.