Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Building tags not work as thought for gopherjs build #598

Copy link
Copy link
Open
@oskca

Description

@oskca
Issue body actions

In my VueJS binding project Vuejs, I tried
to include different version of Vue Javascript Code using go building tags,
but the generated js code does not change with or without building tags.

I hava tow files to switch tags: inc_debug.go

//+build debug

package vue

//using vue-2.1.10.inc.js 219K
import _ "github.com/oskca/gopherjs-vue/jscode/debug" 

and inc_minified.go

//+build !debug

package vue

//using vue-2.1.10.min.inc.js 71K
import _ "github.com/oskca/gopherjs-vue/jscode/debug" 

Steps to show the problem

  1. RM to clean the build
$ rm -rf $GOPATH/pkg/linux_js/github.com/oskca
  1. A refresh build works with expected package building sequence
$ gopherjs build -v --tags debug $GOPATH/src/github.com/oskca/gopherjs-vue/examples/basic/basic.go
github.com/oskca/gopherjs-dom
github.com/oskca/gopherjs-json
github.com/oskca/gopherjs-vue/jscode/debug
github.com/oskca/gopherjs-vue
main
  1. And outputs a debug version
$ lh $GOPATH/src/github.com/oskca/gopherjs-vue/examples/basic/basic.js
-rw-rw-r-- 1 oskca oskca 340K 22:56 basic.js ## bigger file size
  1. The second build without the building flags
$ gopherjs build -v $GOPATH/src/github.com/oskca/gopherjs-vue/examples/basic/basic.go
github.com/oskca/gopherjs-vue/jscode/minified ## expected
main
  1. Outputs not change, still the debug version
$ lh $GOPATH/src/github.com/oskca/gopherjs-vue/examples/basic/basic.js
-rw-rw-r-- 1 oskca oskca 340K 22:57 basic.js ## size not change

If you swap setp 3 and step 2

the generated js code would only include the vue-2.1.10.min.inc.js

$ lh $GOPATH/src/github.com/oskca/gopherjs-vue/examples/basic/basic.js
-rw-rw-r-- 1 oskca oskca 192K 23:10 basic.js ## smaller one

I also tried building tags in *.inc.js, but it not work as #468

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.