Last active
November 8, 2015 20:47
-
-
Save clessg/fc0a1b4ea1c494b33c0c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
... | |
"scripts": { | |
"server": "NODE_PATH=./src node ./server.js", | |
"build": "webpack --config webpack.config.js" | |
} | |
... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Run this using `npm run server`. | |
// Allows us to import ES6 modules. | |
require('babel/register')(); | |
var UserProfile = require('components/users/UserProfile'); | |
// render <UserProfile /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This file is src/components/users/UserProfile.js | |
import Icon from 'components/base/Icon'; | |
import doFunStuff from 'utils/doFunStuff'; | |
// Would normally be: | |
// import Icon from '../base/Icon'; | |
// import doFunStuff from '../../utils/doFunStuff'; | |
// This is handled by Webpack using resolve.root (or resolve.alias). | |
// In Node, it's handled by using NODE_PATH=./src | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
... | |
resolve: { | |
// Makes require('components/base/Icon') reference src/components/base/Icon. | |
root: __dirname + '/src' | |
// Or you could manually specify aliases: | |
// alias: { | |
// 'components': __dirname + '/src/components/', | |
// 'utils': __dirname + '/src/utils/' | |
// } | |
} | |
... | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment