using webpack proxying for api endpoint, serving static assets via webpack
parent
a26d63881b
commit
6c92ac627c
|
|
@ -12,7 +12,7 @@ const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
|
||||||
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
|
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
|
||||||
const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin');
|
const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin');
|
||||||
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
|
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
|
||||||
const WriteFilePlugin = require('write-file-webpack-plugin');
|
// const WriteFilePlugin = require('write-file-webpack-plugin');
|
||||||
const getClientEnvironment = require('./env');
|
const getClientEnvironment = require('./env');
|
||||||
const paths = require('./paths');
|
const paths = require('./paths');
|
||||||
// Webpack uses `publicPath` to determine where the app is being served from.
|
// Webpack uses `publicPath` to determine where the app is being served from.
|
||||||
|
|
@ -282,7 +282,7 @@ module.exports = {
|
||||||
stripPrefix: paths.appBuild.replace(/\\/g, '/') + '/',
|
stripPrefix: paths.appBuild.replace(/\\/g, '/') + '/',
|
||||||
}),
|
}),
|
||||||
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
|
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
|
||||||
new WriteFilePlugin()
|
// new WriteFilePlugin()
|
||||||
],
|
],
|
||||||
// Some libraries import Node modules but don't use them in the browser.
|
// Some libraries import Node modules but don't use them in the browser.
|
||||||
// Tell Webpack to provide empty mocks for them so importing them works.
|
// Tell Webpack to provide empty mocks for them so importing them works.
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ module.exports = function(proxy, allowedHost) {
|
||||||
// Reportedly, this avoids CPU overload on some systems.
|
// Reportedly, this avoids CPU overload on some systems.
|
||||||
// https://github.com/facebookincubator/create-react-app/issues/293
|
// https://github.com/facebookincubator/create-react-app/issues/293
|
||||||
watchOptions: {
|
watchOptions: {
|
||||||
ignored: /node_modules/,
|
ignored: [/node_modules/,'public/png/*']
|
||||||
},
|
},
|
||||||
// Enable HTTPS if the HTTPS environment variable is set to 'true'
|
// Enable HTTPS if the HTTPS environment variable is set to 'true'
|
||||||
https: protocol === 'https',
|
https: protocol === 'https',
|
||||||
|
|
|
||||||
|
|
@ -157,11 +157,11 @@ function build(previousFileSizes) {
|
||||||
|
|
||||||
function copyPublicFolder() {
|
function copyPublicFolder() {
|
||||||
fs.emptyDirSync(paths.appBuild);
|
fs.emptyDirSync(paths.appBuild);
|
||||||
fs.ensureSymlink(paths.appPng,path.resolve(paths.appBuild,'png'));
|
// fs.ensureSymlink(paths.appPng,path.resolve(paths.appBuild,'png'));
|
||||||
fs.copySync(paths.appPublic, paths.appBuild, {
|
// fs.copySync(paths.appPublic, paths.appBuild, {
|
||||||
dereference: true,
|
// dereference: true,
|
||||||
filter: file => file !== paths.appHtml && file !== paths.appPng,
|
// filter: file => file !== paths.appHtml && file !== paths.appPng,
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tools like Cloud9 rely on this.
|
// Tools like Cloud9 rely on this.
|
||||||
|
|
|
||||||
|
|
@ -10,14 +10,14 @@ xmlDir = 'public/'
|
||||||
# from flask_cors import CORS, cross_origin
|
# from flask_cors import CORS, cross_origin
|
||||||
# CORS(app)
|
# CORS(app)
|
||||||
|
|
||||||
@app.route('/')
|
# @app.route('/')
|
||||||
def walle_index():
|
# def walle_index():
|
||||||
return app.send_static_file('index.html')
|
# return app.send_static_file('index.html')
|
||||||
|
|
||||||
|
|
||||||
@app.route('/api/test')
|
# @app.route('/api/test')
|
||||||
def walle_test():
|
# def walle_test():
|
||||||
return "test"
|
# return "test"
|
||||||
|
|
||||||
@app.route('/api/morph')
|
@app.route('/api/morph')
|
||||||
def walle_morph():
|
def walle_morph():
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue