AlexTatiyants / pev

Postgres Explain Visualizer
MIT License
2.77k stars 192 forks source link

Gulp build issues #16

Open seanlinsley opened 8 years ago

seanlinsley commented 8 years ago

Hi there, I'm trying to bundle pev into pghero: https://github.com/ankane/pghero/issues/43.

Unfortunately, I haven't used Node apps very much :sweat_smile:

When running npm run gulp -- build.prod, dist/dev is built. It looks like I could copy that directory and include it into pghero, except that the paths that index.html is looking up files from are incorrect. This is what it has:

<script src="/node_modules/es6-shim/es6-shim.min.js"></script>

While your demo page has script tags that load from the correct relative path:

<script src="lib/es6-shim.min.js"></script>

Any idea why that's happening?

Another issue: there are a large number of unminified JS files in dist/dev/lib. If I can figure out the necessary code to minify and concatenate them, would that be a change you're open to?

seanlinsley commented 8 years ago

Looks like part of the problem is that config.ts sets ENV to dev even when running the build.prod task.

seanlinsley commented 8 years ago

After manually changing those paths, I'm not able to boot the app by simply opening it in a browser, from the filesystem. I get this error:

system.src.js:1085 XMLHttpRequest cannot load file://[redacted]/dist/dev/bootstrap.js. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.

seanlinsley commented 8 years ago

python -m SimpleHTTPServer helps that, but I then had to copy tmp/bootstrap.js into dist/dev/lib, and add this config change:

System.config({"defaultJSExtensions":true,"paths":{"bootstrap":"/lib/bootstrap"}})

After that, the next file to fail is lib/components/app/app.js.

With all the resistance here, I've got to be doing something wrong. How do you build pev for production?

AlexTatiyants commented 8 years ago

Really sorry you’re having these issues. I tried (and failed) to get the prod build to work correctly. I finally ended up running build.prod and then manually editing index.html to point to “lib/*”. I’m certainly not proud of this, but it works.

On March 25, 2016 at 10:19:51 AM, Sean Linsley (notifications@github.com) wrote:

python -m SimpleHTTPServer helps that, but I then had copy tmp/bootstrap.js into dist/dev/lib, and add this config change:

System.config({"defaultJSExtensions":true,"paths":{"bootstrap":"/lib/bootstrap"}}) After that, the next file to fail is lib/components/app/app.js.

With all the resistance here, I've got to be doing something wrong. How do you build pev for production?

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub