New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buffalo build fails to actually run webpack #1560

Closed
hdm opened this Issue Feb 3, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@hdm
Copy link
Contributor

hdm commented Feb 3, 2019

Description

The buffalo build command (0.14.0-beta.3) doesn't actually run webpack properly (on Windows, if not other platforms). The contents of ./public/assets are packaged up, but this leads to a failed build if that directory does not contain the latest content-hash files. For example, if you rm -rf ./public/assets and then run buffalo build, the resulting application will return a 404 for all assets.

Steps to Reproduce the Problem

  1. Delete ./public/assets
  2. Run buffalo build
  3. Run the resulting binary, notice the 404 for all assets.

Expected Behavior

I expected assets to be generated via a call to webpack on buffalo build.

Actual Behavior

The verbose output says webpack is being run, but it isn't.

�[37mDEBU�[0m[2019-02-02T21:48:17-06:00] File: C:\Users\Developer\go\src\github.com\myuser\myapp-console\main.go
�[37mDEBU�[0m[2019-02-02T21:48:17-06:00] File: C:\Users\Developer\go\src\github.com\myuser\myapp-console\a\a.go
�[37mDEBU�[0m[2019-02-02T21:48:17-06:00] File: C:\Users\Developer\go\src\github.com\myuser\myapp-console\a\a.go
�[37mDEBU�[0m[2019-02-02T21:48:17-06:00] File: C:\Users\Developer\go\src\github.com\myuser\myapp-console\buffalo_build_main.go
�[37mDEBU�[0m[2019-02-02T21:48:17-06:00] File: C:\Users\Developer\go\src\github.com\myuser\myapp-console\migrations\.pop-tmp.md
�[37mDEBU�[0m[2019-02-02T21:48:17-06:00] File: C:\Users\Developer\go\src\github.com\myuser\myapp-console\migrations\.pop-tmp.md
�[37mDEBU�[0m[2019-02-02T21:48:17-06:00] File: C:\Users\Developer\go\src\github.com\myuser\myapp-console\a\inflections.json
�[37mDEBU�[0m[2019-02-02T21:48:17-06:00] File: C:\Users\Developer\go\src\github.com\myuser\myapp-console\a\database.go
�[37mDEBU�[0m[2019-02-02T21:48:17-06:00] setting NODE_ENV = development
�[37mDEBU�[0m[2019-02-02T21:48:17-06:00] Exec: node_modules\.bin\webpack
�[37mDEBU�[0m[2019-02-02T21:48:20-06:00] LookPath: dep
�[37mDEBU�[0m[2019-02-02T21:48:20-06:00] Exec: dep ensure
�[37mDEBU�[0m[2019-02-02T21:48:23-06:00] Exec: go build -i -v -tags development -o releases\binary.exe -ldflags -s -w -X main.Version=v0.0.17 -X main.BuildDate=20190203034809 -X main.BuildHash=f3131cf6ea050b8323f704a8ac0fb6d41f9d806b
github.com/myuser/myapp-console
�[37mDEBU�[0m[2019-02-02T21:48:25-06:00] *parser.Parser#NewFromRoots �[37moptions�[0m="{\"IgnoreImports\":false,\"Ignores\":null}" �[37mroots�[0m="[\"C:\\\\Users\\\\Developer\\\\go\\\\src\\\\github.com\\\\myuser\\\\myapp-console\"]"
�[37mDEBU�[0m[2019-02-02T21:48:25-06:00] *parser.Parser#NewFromRoots �[37mwalking�[0m="C:\\Users\\Developer\\go\\src\\github.com\\myuser\\myapp-console"

A workaround is to run the following before each call to buffalo build:

rm -rf ./public/assets/
./node_modules/.bin/webpack

Info

### Buffalo Version
v0.14.0-beta.3

### App Information
Pwd=C:\Users\Developer\go\src\github.com\myuser\myapp-console
Root=C:\Users\Developer\go\src\github.com\myuser\myapp-console
GoPath=C:\Users\Developer\go
PackagePkg=github.com/myuser/myapp-console
ActionsPkg=github.com/myuser/myapp-console/actions
ModelsPkg=github.com/myuser/myapp-console/models
GriftsPkg=github.com/myuser/myapp-console/grifts
WithModules=false
Name=myapp-console
Bin=bin\myapp-console.exe
VCS=git
WithPop=true
WithSQLite=false
WithDep=true
WithWebpack=true
WithNodeJs=true
WithYarn=true
WithDocker=false
WithGrifts=true
AsWeb=true
AsAPI=false

### Go Version
go version go1.11.4 windows/amd64

### Go Env
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Developer\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\Developer\go
set GOPROXY=
set GORACE=
set GOROOT=C:\Go
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\DEVELO~1\AppData\Local\Temp\go-build989579850=/tmp/go-build -gno-record-gcc-switches

### Node Version
v10.15.0

### NPM Version
6.4.1

### Yarn Version
1.13.0

### PostgreSQL Version
PostgreSQL Not Found

### MySQL Version
MySQL Not Found

### SQLite Version
3.7.17 2013-05-20 00:56:22 118a3b35693b134d56ebd780123b7fd6f1497668

### Dep Version
dep:
 version     : devel
 build date  : 
 git hash    : 
 go version  : go1.11.1
 go compiler : gc
 platform    : windows/amd64
 features    : ImportDuringSolve=false

### Dep Status
Gopkg.lock is out of sync with imports and/or Gopkg.toml. Run `dep check` for details.
PROJECT  MISSING PACKAGES
input-digest mismatch

@hdm

This comment has been minimized.

Copy link
Contributor Author

hdm commented Feb 3, 2019

The root cause might be how Windows webpack is named, the actual file name to exec should probably be node_modules\.bin\webpack.cmd, but its strange that this works in dev mode but not during builds.

@markbates markbates added this to the v0.14.0 milestone Feb 10, 2019

@markbates markbates self-assigned this Feb 10, 2019

@markbates markbates closed this Feb 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment