Coder Social home page Coder Social logo

webpack-example's Introduction

webpack-example

!Important

If you get here you should move on to: https://github.com/christianalfoni/webpack-express-boilerplate. It is the boilerplate from this article: http://www.christianalfoni.com/articles/2015_04_19_The-ultimate-webpack-setup. It is just a better setup :-)

An example of webpack workflow, as presented in the following article Creating a workflow with WebPack

How to use

  • npm install
  • npm run dev - localhost:8080
  • npm run deploy - deploy to dist folder

Introducing the webpack cookbook

@bebraw and me have been working on a cookbook for React JS and Webpack practices. Check it out at react-webpack-cookbook and build your custom config file with the best practices in the community.

webpack-example's People

Contributors

christianalfoni avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

webpack-example's Issues

react-router

It works fine, but I wanted to route with react-router.
Why after adding only variable everything crashes? Only this line.

var Router = require('react-router');
ERROR in ./~/react-router/lib/components/Link.js
Module not found: Error: Cannot resolve 'file' or 'directory' /home/piotr/Deskto
p/www/webpack-example/bower_components/react/react.min.js/lib/Object.assign in /
home/piotr/Desktop/www/webpack-example/node_modules/react-router/lib/components
 @ ./~/react-router/lib/components/Link.js 10:13-47

react-router / webpack / webpack-dev-server

"npm run deploy" works wrong

Seems like the example doesn't work after npm run deploy.
Error in console: Uncaught Error: [HMR] Hot Module Replacement is disabled.

After npm run dev everything works fine.

How about a sample test file?

Awesome boilerplate!.

Testing React components can be tricky also. It would be cool to see you post a mocha tests for a couple of the components.

Thanks.

Adding react-router dependency

I know it's just supposed to be an example, but I found no better place, because my webpack config is based on your workflow example. Thank you very much for it!

Now to my issue:
If you try yo add react-router as a dependency. You will get in to trouble as it expects React on the window object. You end up with the following error message:
undefined is not an object (evaluating 'React.createClass')

I tried shimming methods for example with the imports-loader:
require("imports?React=react!react-router")

or add it with the ProviderPlugin

new webpack.ProvidePlugin({ React: "react", "windows.React": "react" })

Both didn't helped. So I did the stupid thing with window.React = React within my code and that worked.

This fix works within the the dev-server. As soon as you do a build of the bundles you end up with the same error message.

Do you have any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.