Build example in `example/bundle.js`
- Add watch script - Make `npm run build` builds the example so that it’s included on npmrelease
parent
f01ad53b6f
commit
ecf3784d32
|
@ -1,4 +1,4 @@
|
||||||
node_modules/
|
node_modules/
|
||||||
build/
|
|
||||||
data/
|
data/
|
||||||
dist/
|
dist/
|
||||||
|
bundle.js
|
||||||
|
|
|
@ -6,6 +6,6 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div></div>
|
<div></div>
|
||||||
<script src="../build/example.js"></script>
|
<script src="./bundle.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -3,8 +3,8 @@ var path = require('path')
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: path.resolve('example/index.js'),
|
entry: path.resolve('example/index.js'),
|
||||||
output: {
|
output: {
|
||||||
path: path.resolve('build'),
|
path: path.resolve('example'),
|
||||||
filename: 'example.js',
|
filename: 'bundle.js',
|
||||||
},
|
},
|
||||||
|
|
||||||
module: {
|
module: {
|
||||||
|
|
|
@ -42,11 +42,13 @@
|
||||||
"webpack": "1.12.14"
|
"webpack": "1.12.14"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "rimraf build/ data/ dist/",
|
"clean": "rimraf data/ dist/",
|
||||||
"build:data": "node scripts/build-data",
|
"build:data": "node scripts/build-data",
|
||||||
"build:example": "node scripts/build-example",
|
"build:example": "node scripts/build-example",
|
||||||
"build:dist": "node scripts/build-dist",
|
"build:dist": "node scripts/build-dist",
|
||||||
"build": "npm run build:data && npm run build:dist",
|
"build": "npm run build:data && npm run build:example && npm run build:dist",
|
||||||
|
"watch:example": "node scripts/watch-example",
|
||||||
|
"watch": "npm run watch:example",
|
||||||
"react:clean": "rimraf node_modules/{react,react-dom,react-addons-test-utils}",
|
"react:clean": "rimraf node_modules/{react,react-dom,react-addons-test-utils}",
|
||||||
"react:14": "npm run react:clean && npm i react@^0.14 react-dom@^0.14 react-addons-test-utils@^0.14 --save-dev",
|
"react:14": "npm run react:clean && npm i react@^0.14 react-dom@^0.14 react-addons-test-utils@^0.14 --save-dev",
|
||||||
"react:15": "npm run react:clean && npm i react@^15 react-dom@^15 react-addons-test-utils@^15 --save-dev",
|
"react:15": "npm run react:clean && npm i react@^15 react-dom@^15 react-addons-test-utils@^15 --save-dev",
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
var path = require('path')
|
var path = require('path')
|
||||||
var webpack = require('webpack')
|
var webpack = require('webpack')
|
||||||
|
var config = require('../example/webpack.config.js')
|
||||||
|
|
||||||
var config = require('../example/webpack.config.js'),
|
webpack(config, (err, stats) => {
|
||||||
compiler = webpack(config)
|
|
||||||
|
|
||||||
compiler.watch({}, (err, stats) => {
|
|
||||||
if (err) throw err
|
if (err) throw err
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
var path = require('path')
|
||||||
|
var webpack = require('webpack')
|
||||||
|
|
||||||
|
var config = require('../example/webpack.config.js'),
|
||||||
|
compiler = webpack(config)
|
||||||
|
|
||||||
|
compiler.watch({}, (err, stats) => {
|
||||||
|
if (err) throw err
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
stats.toString({
|
||||||
|
colors: true,
|
||||||
|
hash: true,
|
||||||
|
version: false,
|
||||||
|
timings: true,
|
||||||
|
assets: true,
|
||||||
|
chunks: false,
|
||||||
|
chunkModules: false,
|
||||||
|
modules: false,
|
||||||
|
children: false,
|
||||||
|
cached: false,
|
||||||
|
reasons: false,
|
||||||
|
source: false,
|
||||||
|
errorDetails: false,
|
||||||
|
chunkOrigins: false,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
})
|
Loading…
Reference in New Issue