-
-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
661 additions
and
608 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,8 +12,6 @@ npm-debug.log | |
coverage | ||
|
||
# Build output | ||
umd | ||
commonjs | ||
build | ||
|
||
# Flow | ||
|
This file contains 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 contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import express from 'express' | ||
import webpack from 'webpack' | ||
import devMiddleware from 'webpack-dev-middleware' | ||
import hotMiddleware from 'webpack-hot-middleware' | ||
import config from './tools/webpack/config.babel' | ||
|
||
const port = process.env.PORT || 1337 | ||
const app = express() | ||
const compiler = webpack(config) | ||
app.use( | ||
devMiddleware(compiler, { | ||
quiet: true, | ||
noInfo: true, | ||
headers: { | ||
'Access-Control-Allow-Origin': '*', | ||
}, | ||
// Ensure that the public path is taken from the compiler webpack config | ||
// as it will have been created as an absolute path to avoid conflicts | ||
// with an node servers. | ||
publicPath: compiler.options.output.publicPath, | ||
}), | ||
) | ||
app.use(hotMiddleware(compiler)) | ||
|
||
app.listen(port, () => console.log(`Example running on port ${port}...`)) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
{ | ||
"name": "my-library-example", | ||
"name": "react-sizeme-example", | ||
"version": "1.0.0", | ||
"description": "An example of my-library", | ||
"main": "index.js", | ||
"description": "An example of react-sizeme", | ||
"scripts": { | ||
"build": "NODE_ENV=production webpack --config ./tools/webpack/config.babel.js", | ||
"start": "babel-node server.js" | ||
}, | ||
"author": "", | ||
"license": "MIT", | ||
"devDependencies": {}, | ||
"dependencies": { | ||
"app-root-dir": "^1.0.2", | ||
"babel-cli": "^6.18.0", | ||
"babel-core": "^6.21.0", | ||
"babel-loader": "^6.2.10", | ||
"babel-preset-latest": "^6.16.0", | ||
"babel-preset-react": "^6.16.0", | ||
"babel-preset-stage-3": "^6.17.0", | ||
"babel-register": "^6.18.0", | ||
"express": "^4.14.0", | ||
"html-webpack-plugin": "^2.26.0", | ||
"babel-cli": "6.24.0", | ||
"babel-core": "6.24.0", | ||
"babel-loader": "6.4.1", | ||
"babel-preset-latest": "6.24.0", | ||
"babel-preset-react": "6.23.0", | ||
"babel-preset-stage-3": "6.22.0", | ||
"babel-register": "6.24.0", | ||
"express": "4.15.2", | ||
"html-webpack-plugin": "2.28.0", | ||
"react": "^15.4.2", | ||
"react-dom": "^15.4.2", | ||
"react-sizeme": "file:../../", | ||
"webpack": "^2.2.0-rc.3", | ||
"webpack-dev-middleware": "^1.9.0", | ||
"webpack-hot-middleware": "^2.15.0" | ||
"react-sizeme": "https://github.com/ctrlplusb/react-sizeme", | ||
"webpack": "2.3.2", | ||
"webpack-dev-middleware": "1.10.1", | ||
"webpack-hot-middleware": "2.17.1" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,9 @@ | ||
import express from 'express' | ||
import webpack from 'webpack' | ||
import devMiddleware from 'webpack-dev-middleware' | ||
import hotMiddleware from 'webpack-hot-middleware' | ||
import config from './tools/webpack/config' | ||
import path from 'path' | ||
|
||
const port = process.env.PORT || 1337 | ||
const app = express() | ||
const compiler = webpack(config) | ||
app.use( | ||
devMiddleware(compiler, { | ||
quiet: true, | ||
noInfo: true, | ||
headers: { | ||
'Access-Control-Allow-Origin': '*', | ||
}, | ||
// Ensure that the public path is taken from the compiler webpack config | ||
// as it will have been created as an absolute path to avoid conflicts | ||
// with an node servers. | ||
publicPath: compiler.options.output.publicPath, | ||
}), | ||
) | ||
app.use(hotMiddleware(compiler)) | ||
|
||
app.use(express.static(path.resolve('./build'))) | ||
|
||
app.listen(port, () => console.log(`Example running on port ${port}...`)) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { resolve as resolvePath } from 'path' | ||
import webpack from 'webpack' | ||
import HtmlWebpackPlugin from 'html-webpack-plugin' | ||
import appRootDir from 'app-root-dir' | ||
import pkg from '../../package.json' | ||
|
||
const config = { | ||
entry: { | ||
index: resolvePath(appRootDir.get(), './src/index.js'), | ||
}, | ||
output: { | ||
path: resolvePath(appRootDir.get(), './build'), | ||
filename: `${pkg.name}.js`, | ||
publicPath: '/', | ||
}, | ||
target: 'web', | ||
plugins: [ | ||
new webpack.NoEmitOnErrorsPlugin(), | ||
new webpack.DefinePlugin({ | ||
'process.env.NODE_ENV': JSON.stringify( | ||
process.env.NODE_ENV || 'development', | ||
), | ||
}), | ||
new HtmlWebpackPlugin({ | ||
filename: 'index.html', | ||
template: resolvePath(__dirname, './html.js'), | ||
inject: true, | ||
// We can pass custom data to the template... | ||
custom: { | ||
name: pkg.name, | ||
description: pkg.description, | ||
}, | ||
}), | ||
], | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
loader: 'babel-loader', | ||
include: [resolvePath(appRootDir.get(), './src')], | ||
}, | ||
], | ||
}, | ||
} | ||
|
||
if (process.env.NODE_ENV === 'production') { | ||
config.plugins.push( | ||
new webpack.optimize.UglifyJsPlugin({ | ||
sourceMap: false, | ||
compress: { | ||
screw_ie8: true, | ||
warnings: false, | ||
}, | ||
mangle: { | ||
screw_ie8: true, | ||
}, | ||
output: { | ||
comments: false, | ||
screw_ie8: true, | ||
}, | ||
}), | ||
) | ||
} | ||
|
||
module.exports = config |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.