Generate /playground from /src/playground

The playground now must be loaded with a URL that ends in "/playground/"
or "/playground/index.html"; loading at "/" will no longer work.

The /playground folder is now purely an output of the build process,
rather than being a mix of build output and static content. The static
content that was previously there (namely, index.html) has been moved
into /src/playground. The `contentBase` has been set to `false` to avoid
confusion between current, in-memory build output and stale, on-disk
build output.
This commit is contained in:
Christopher Willis-Ford 2017-03-08 14:47:14 -08:00
parent f8c45d8552
commit 10db85594f
4 changed files with 13 additions and 12 deletions

4
.gitignore vendored
View File

@ -14,6 +14,4 @@ npm-*
# Build
/dist
/playground/scratch-render.js
/playground/scratch-render.js.map
/playground/docs
/playground

View File

@ -28,6 +28,7 @@
"babel-polyfill": "^6.22.0",
"babel-preset-es2015": "^6.22.0",
"base64-loader": "^1.0.0",
"copy-webpack-plugin": "^4.0.1",
"docdash": "^0.4.0",
"eslint": "^3.16.1",
"eslint-config-scratch": "^3.1.0",

View File

@ -1,17 +1,12 @@
const CopyWebpackPlugin = require('copy-webpack-plugin');
const path = require('path');
const webpack = require('webpack');
const base = {
devServer: {
contentBase: path.resolve(__dirname, 'playground'),
contentBase: false,
host: '0.0.0.0',
watchOptions: {
aggregateTimeout: 300,
poll: 1000
},
stats: {
colors: true
}
port: process.env.PORT || 8061
},
devtool: 'source-map',
module: {
@ -47,7 +42,14 @@ module.exports = [
output: {
path: path.resolve(__dirname, 'playground'),
filename: '[name].js'
}
},
plugins: base.plugins.concat([
new CopyWebpackPlugin([
{
from: 'src/playground'
}
])
])
}),
// Web-compatible
Object.assign({}, base, {