Skip to content

Commit

Permalink
bugfix: Fix dist dir build issues (#252)
Browse files Browse the repository at this point in the history
* dist: Create basic go structure.

This commit creates the basic go structure to be able to build without
the frontend build.

* dist: Cleanup frontend build.

This commit makes it so that a build + clean resets the repo back to the
expected state.
  • Loading branch information
betterengineering authored Apr 14, 2022
1 parent 10a771f commit 87fe8da
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 11 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ pixlet

# Releases
build/
dist/
out/

# Dependency directories
Expand Down
2 changes: 2 additions & 0 deletions dist/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
static/*
!static/keepdir
File renamed without changes.
1 change: 1 addition & 0 deletions dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<! -- Generated! Do not commit changes! -->
Empty file added dist/static/keepdir
Empty file.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"start": "webpack serve --config webpack.dev.js",
"build": "webpack --config webpack.prod.js",
"clean": "rm -rf dist/",
"clean": "rm -rf dist/static/ && git restore dist/",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
Expand All @@ -31,7 +31,6 @@
"@svgr/webpack": "6.2.1",
"babel-loader": "8.2.4",
"babel-preset-react": "6.24.1",
"copy-webpack-plugin": "10.2.4",
"css-loader": "6.7.1",
"file-loader": "6.2.0",
"html-webpack-plugin": "5.5.0",
Expand Down
9 changes: 1 addition & 8 deletions webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,13 @@ const { merge } = require('webpack-merge');
const common = require('./webpack.common.js');
const path = require('path');
const HtmlWebPackPlugin = require("html-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");

const htmlPlugin = new HtmlWebPackPlugin({
template: './src/index.html',
filename: '../index.html',
favicon: 'src/favicon.png'
});

const copyPlugin = new CopyPlugin({
patterns: [
{ from: "src/dist.go.txt", to: "../dist.go" },
],
});

module.exports = merge(common, {
mode: 'production',
devtool: 'source-map',
Expand All @@ -26,5 +19,5 @@ module.exports = merge(common, {
filename: '[name].[chunkhash].js',
clean: true,
},
plugins: [htmlPlugin, copyPlugin]
plugins: [htmlPlugin]
});

0 comments on commit 87fe8da

Please sign in to comment.