Testing webpack-dev-server
This commit is contained in:
parent
3298f5c932
commit
058a0adf51
|
@ -1,6 +1,4 @@
|
|||
from flask import Flask
|
||||
from flask_webpack import Webpack
|
||||
from werkzeug.serving import run_simple
|
||||
|
||||
from blueprints.joyce import joyce
|
||||
from blueprints.api import api
|
||||
|
@ -8,24 +6,15 @@ from blueprints.api import api
|
|||
# Initialize application
|
||||
application = Flask(__name__)
|
||||
|
||||
WEBPACK_MANIFEST_PATH = './static/manifest.json'
|
||||
|
||||
params = {
|
||||
'ENV': 'staging',
|
||||
'DEBUG': True,
|
||||
'WEBPACK_MANIFEST_PATH': WEBPACK_MANIFEST_PATH
|
||||
}
|
||||
|
||||
|
||||
application.config.update(params)
|
||||
|
||||
webpack = Webpack()
|
||||
webpack.init_app(application)
|
||||
|
||||
# Register blueprints
|
||||
application.register_blueprint(joyce)
|
||||
application.register_blueprint(api, url_prefix='/api')
|
||||
|
||||
if __name__ == "__main__":
|
||||
application.run()
|
||||
# run_simple('localhost', 5000, application, use_reloader=True, use_debugger=True)
|
||||
application.run()
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Before Width: | Height: | Size: 434 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
17
package.json
17
package.json
|
@ -4,8 +4,8 @@
|
|||
"description": "Reader and Editor for Hypertext",
|
||||
"main": "app.js",
|
||||
"scripts": {
|
||||
"build": "webpack-cli --config webpack.prod.js --mode=production",
|
||||
"watch": "webpack-cli --config webpack.dev.js --watch --mode=development",
|
||||
"build": "rimraf static/js/ && webpack --config webpack.prod.js --mode=production",
|
||||
"dev": "rimraf static/js/ && webpack-dev-server --hot --inline --config webpack.dev.js --mode=development",
|
||||
"test": "python setup.py && jest --config jest.config.js --no-cache && python setup.py"
|
||||
},
|
||||
"author": "Alex Hunt",
|
||||
|
@ -25,10 +25,7 @@
|
|||
"react-router": "^4.2.0",
|
||||
"react-router-dom": "^4.2.2",
|
||||
"react-router-redux": "^5.0.0-alpha.9",
|
||||
"redux": "^3.7.2",
|
||||
"webpack": "^4.25.1",
|
||||
"webpack-bundle-analyzer": "^2.13.1",
|
||||
"webpack-cli": "^3.1.2"
|
||||
"redux": "^3.7.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-core": "^6.26.0",
|
||||
|
@ -37,21 +34,21 @@
|
|||
"babel-preset-env": "^1.6.1",
|
||||
"babel-preset-react": "^6.24.1",
|
||||
"babel-preset-stage-3": "^6.24.1",
|
||||
"clean-webpack-plugin": "^0.1.17",
|
||||
"css-loader": "^0.28.7",
|
||||
"extract-text-webpack-plugin": "^3.0.2",
|
||||
"file-loader": "^1.1.11",
|
||||
"jest": "^22.4.3",
|
||||
"manifest-revision-webpack-plugin": "^0.4.1",
|
||||
"node-sass": "^4.6.0",
|
||||
"postcss-loader": "^2.0.8",
|
||||
"precss": "^2.0.0",
|
||||
"rimraf": "^2.6.2",
|
||||
"sass-loader": "^6.0.6",
|
||||
"style-loader": "^0.19.0",
|
||||
"sync-exec": "^0.6.2",
|
||||
"uglifyjs-webpack-plugin": "^2.0.1",
|
||||
"webpack": "^4.6.0",
|
||||
"webpack-bundle-analyzer": "^2.11.1",
|
||||
"webpack-cli": "^2.0.15",
|
||||
"webpack-cli": "^3.1.2",
|
||||
"webpack-dev-server": "^3.1.10",
|
||||
"webpack-merge": "^4.1.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
<!doctype html>
|
||||
<!DOCTYPE html>
|
||||
<head>
|
||||
<title>Joyce - Reader</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="manifest" href="static/manifest.json">
|
||||
<link rel="icon" href="{{ url_for('static', filename='icon.png') }}" type="image/png">
|
||||
<link rel="icon" type="image/png" href="static/image/icon.png">
|
||||
<link rel="icon" type="image/png" href="/static/image/icon.png">
|
||||
</head>
|
||||
<body>
|
||||
<!-- Reader Layout -->
|
||||
<div id="wrapper">
|
||||
</div>
|
||||
<!-- Scripts -->
|
||||
<script src="{{asset_url_for('joyce.js')}}"></script>
|
||||
<script src="/static/js/joyce.js"></script>
|
||||
</body>
|
|
@ -1,5 +1,3 @@
|
|||
// const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||
const ManifestRevisionPlugin = require('manifest-revision-webpack-plugin')
|
||||
const webpack = require('webpack')
|
||||
const path = require('path')
|
||||
|
||||
|
@ -12,6 +10,11 @@ module.exports = {
|
|||
rootAssetPath + 'stylesheets/' + 'joyce.scss'
|
||||
]
|
||||
},
|
||||
output: {
|
||||
publicPath: "/static/js/",
|
||||
filename: '[name].js',
|
||||
path: path.resolve(__dirname, 'static/js/')
|
||||
},
|
||||
module : {
|
||||
rules: [
|
||||
{
|
||||
|
@ -52,7 +55,7 @@ module.exports = {
|
|||
]
|
||||
}
|
||||
}, {
|
||||
loader: 'sass-loader' // compiles SASS to CSS
|
||||
loader: 'sass-loader'
|
||||
}]
|
||||
},
|
||||
{
|
||||
|
@ -62,16 +65,4 @@ module.exports = {
|
|||
}]
|
||||
}
|
||||
]},
|
||||
plugins: [
|
||||
new ManifestRevisionPlugin(path.join('static/', 'manifest.json'), {
|
||||
rootAssetPath: rootAssetPath
|
||||
}),
|
||||
// new webpack.ProvidePlugin({
|
||||
// bootstrap: 'bootstrap'
|
||||
// $: 'jquery',
|
||||
// jQuery: 'jquery',
|
||||
// 'window.jQuery': 'jquery',
|
||||
// Popper: ['popper.js', 'default']
|
||||
// }),
|
||||
],
|
||||
};
|
|
@ -1,24 +1,14 @@
|
|||
const merge = require('webpack-merge');
|
||||
const common = require('./webpack.common.js');
|
||||
const path = require('path')
|
||||
const CleanWebpackPlugin = require('clean-webpack-plugin')
|
||||
|
||||
const pathsToClean = [
|
||||
'static/js'
|
||||
]
|
||||
|
||||
module.exports = merge(common, {
|
||||
output: {
|
||||
publicPath: "/static/js/",
|
||||
filename: '[name].[hash].js',
|
||||
path: path.resolve(__dirname, 'static/js/')
|
||||
devServer: {
|
||||
contentBase: '.',
|
||||
hot: true
|
||||
},
|
||||
watch: true,
|
||||
watchOptions: {
|
||||
poll: true,
|
||||
ignored: /node_modules/
|
||||
},
|
||||
plugins: [
|
||||
new CleanWebpackPlugin(pathsToClean),
|
||||
]
|
||||
});
|
|
@ -1,26 +1,15 @@
|
|||
const webpack = require('webpack');
|
||||
const merge = require('webpack-merge');
|
||||
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
|
||||
const CleanWebpackPlugin = require('clean-webpack-plugin')
|
||||
const common = require('./webpack.common.js');
|
||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
||||
const path = require('path')
|
||||
|
||||
const pathsToClean = [
|
||||
'dist/js'
|
||||
]
|
||||
|
||||
module.exports = merge(common, {
|
||||
output: {
|
||||
publicPath: "/dist/js/",
|
||||
filename: '[name].js',
|
||||
path: path.resolve(__dirname, 'dist/js/')
|
||||
},
|
||||
optimization: {
|
||||
minimize: true
|
||||
},
|
||||
plugins: [
|
||||
new CleanWebpackPlugin(pathsToClean),
|
||||
new UglifyJSPlugin(),
|
||||
new BundleAnalyzerPlugin,
|
||||
new webpack.LoaderOptionsPlugin({
|
||||
|
|
Loading…
Reference in New Issue