Skip to content

Commit 10db855

Browse files
author
Christopher Willis-Ford
committed
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.
1 parent f8c45d8 commit 10db855

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,4 @@ npm-*
1414

1515
# Build
1616
/dist
17-
/playground/scratch-render.js
18-
/playground/scratch-render.js.map
19-
/playground/docs
17+
/playground

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"babel-polyfill": "^6.22.0",
2929
"babel-preset-es2015": "^6.22.0",
3030
"base64-loader": "^1.0.0",
31+
"copy-webpack-plugin": "^4.0.1",
3132
"docdash": "^0.4.0",
3233
"eslint": "^3.16.1",
3334
"eslint-config-scratch": "^3.1.0",
File renamed without changes.

webpack.config.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1+
const CopyWebpackPlugin = require('copy-webpack-plugin');
12
const path = require('path');
23
const webpack = require('webpack');
34

45
const base = {
56
devServer: {
6-
contentBase: path.resolve(__dirname, 'playground'),
7+
contentBase: false,
78
host: '0.0.0.0',
8-
watchOptions: {
9-
aggregateTimeout: 300,
10-
poll: 1000
11-
},
12-
stats: {
13-
colors: true
14-
}
9+
port: process.env.PORT || 8061
1510
},
1611
devtool: 'source-map',
1712
module: {
@@ -47,7 +42,14 @@ module.exports = [
4742
output: {
4843
path: path.resolve(__dirname, 'playground'),
4944
filename: '[name].js'
50-
}
45+
},
46+
plugins: base.plugins.concat([
47+
new CopyWebpackPlugin([
48+
{
49+
from: 'src/playground'
50+
}
51+
])
52+
])
5153
}),
5254
// Web-compatible
5355
Object.assign({}, base, {

0 commit comments

Comments
 (0)