Merge pull request #59 from lowdefy/webpack-server

chore: update webpack server config
This commit is contained in:
Gervwyk 2020-10-15 16:09:36 +02:00 committed by GitHub
commit 94f7b2af6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 44 additions and 14 deletions

View File

@ -26,12 +26,13 @@
"dist/*"
],
"scripts": {
"start": "webpack serve",
"build": "babel src --copy-files --out-dir dist",
"test": "jest --coverage",
"dev": "webpack serve",
"npm-publish": "npm publish --access public",
"prepare": "yarn build",
"prepublishOnly": "yarn build",
"npm-publish": "npm publish --access public"
"start": "webpack serve",
"test": "jest --coverage"
},
"dependencies": {
"@lowdefy/helpers": "1.0.0",
@ -70,4 +71,4 @@
"yaml-jest": "1.0.5",
"yaml-loader": "0.6.0"
}
}
}

View File

@ -1,4 +1,5 @@
const { merge } = require('webpack-merge');
const webpack = require('webpack');
const common = require('./webpack.common.js');
const path = require('path');
@ -7,6 +8,11 @@ module.exports = merge(common, {
devtool: 'eval-source-map',
devServer: {
contentBase: path.join(__dirname, 'dist'),
port: 3001,
port: 3000,
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development'),
}),
],
});

View File

@ -1,6 +1,12 @@
const { merge } = require('webpack-merge');
const webpack = require('webpack');
const common = require('./webpack.common.js');
module.exports = merge(common, {
mode: 'production',
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production'),
}),
],
});

View File

@ -26,12 +26,13 @@
"dist/*"
],
"scripts": {
"start": "webpack serve",
"build": "babel src --out-dir dist",
"test": "jest --coverage",
"dev": "webpack serve",
"npm-publish": "npm publish --access public",
"prepare": "yarn build",
"prepublishOnly": "yarn build",
"npm-publish": "npm publish --access public"
"start": "webpack serve",
"test": "jest --coverage"
},
"dependencies": {
"@lowdefy/type": "1.0.1",
@ -68,4 +69,4 @@
"yaml-jest": "1.0.5",
"yaml-loader": "0.6.0"
}
}
}

View File

@ -29,8 +29,8 @@
"build": "webpack --config webpack.prod.js",
"clean": "rm -rf dist",
"prepublishOnly": "yarn build",
"serve": "serve dist -p 3001",
"start": "webpack serve"
"start": "serve dist -p 3001",
"dev": "webpack serve --config webpack.dev.js"
},
"dependencies": {
"@apollo/client": "3.2.4",
@ -64,4 +64,4 @@
"webpack-dev-server": "3.11.0",
"webpack-merge": "5.2.0"
}
}
}

View File

@ -31,7 +31,7 @@ const retryLink = new RetryLink();
// TODO: make uri configurable
const httpLink = new HttpLink({
uri: '/api/graphql',
uri: process.env.GRAPHQL_URI,
});
// TODO: Handle errors

View File

@ -1,7 +1,9 @@
const { merge } = require('webpack-merge');
const common = require('./webpack.common.js');
const webpack = require('webpack');
const path = require('path');
const common = require('./webpack.common.js');
module.exports = merge(common, {
mode: 'development',
devtool: 'eval-source-map',
@ -9,4 +11,11 @@ module.exports = merge(common, {
contentBase: path.join(__dirname, 'dist'),
port: 3001,
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development'),
'process.env.GRAPHQL_URI': JSON.stringify('http://localhost:3000/api/graphql'),
}),
],
});

View File

@ -1,6 +1,13 @@
const { merge } = require('webpack-merge');
const webpack = require('webpack');
const common = require('./webpack.common.js');
module.exports = merge(common, {
mode: 'production',
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production'),
'process.env.GRAPHQL_URI': JSON.stringify('/api/graphql'),
}),
],
});