rearrange build scripts and solve sourcemap path issue