iansinnott / react-static-boilerplate

A boilerplate for building static sites with Webpack 2, React and React Router
107 stars 16 forks source link

Build does not work #3

Closed kifahhk closed 8 years ago

kifahhk commented 8 years ago

Hello,

npm build does not seem to do anything. I tried frustrated to get it working, but no use. am I missing anything?

OS: Windows npm: 3.8.0 node: 4.3.1

iansinnott commented 8 years ago

Hey @kifahhk, I'm currently unable to reproduce. Could you fork the project or create a test repo that I can use to reproduce?

Make sure you are running npm run build and NOT npm build. The latter will do nothing as it is a native npm command. See npm help build for more details.

Currently I run:

git clone iansinnott/react-static-boilerplate
cd react-static-boilerplate
npm install
npm run build

And everything works as expected.

iansinnott commented 8 years ago

Thanks for bringing to my attention. I went back and noticed that I had the wrong command listed in the Readme. Updated now. Let me know if using npm run build fixes your issue.

kifahhk commented 8 years ago

Hello @iansinnott , thanks for replying, I just got the problem.

  1. It seems, that you need to add "&" for multiple commands in Windows.
  2. use the keyword SET for node to assign "production" to NODE_ENV

    i.e: SET NODE_ENV=production & webpack --config webpack.config.prod.js instead of NODE_ENV=production webpack --config webpack.config.prod.js

It works like charming! ofc with "npm run build"

I also would like to give relative public paths instead of root. e.g: new StaticSitePlugin({ src: 'app', stylesheet: './app.css', favicon: './favicon.ico', }),

maybe you can add this in readme for windows users

iansinnott commented 8 years ago

Nice! I'm glad you got it working on a windows system. I created a new issue about Windows support.

I also would like to give relative public paths instead of root.

I'm not quite sure what you mean here. Could you elaborate?

kifahhk commented 8 years ago

Since we are talking about static App, I don't see it harmful to link the style for example: like this; <link rel='stylesheet' href='./app.css' /> // relative to the working directory instead of: <link rel='stylesheet' href='/app.css' /> // root directory

but forget about it, It's not necessary

iansinnott commented 8 years ago

OK, thanks for closing this out. Let me know if you run into any other issues.