mirror of https://github.com/apache/superset.git
feat(dev): dont override asset manifest in dev-server (#11648)
Override manifest.json only when `npm run dev`, not `npm run dev-server`. This allows developers to compare between the current version of Superset with what they are working on without switching back and forth between branches. All they need to do is to first start the current version with production build: ``` npm run build superset run -p 8088 ``` Then start the dev server in another window: ``` npm run dev-server ```
This commit is contained in:
parent
a9f9c4bbd5
commit
4f21dea55f
|
@ -47,6 +47,7 @@ const {
|
||||||
nameChunks = false,
|
nameChunks = false,
|
||||||
} = parsedArgs;
|
} = parsedArgs;
|
||||||
const isDevMode = mode !== 'production';
|
const isDevMode = mode !== 'production';
|
||||||
|
const isDevServer = process.argv[1].includes('webpack-dev-server');
|
||||||
|
|
||||||
const output = {
|
const output = {
|
||||||
path: BUILD_DIR,
|
path: BUILD_DIR,
|
||||||
|
@ -94,17 +95,9 @@ const plugins = [
|
||||||
entrypoints: entryFiles,
|
entrypoints: entryFiles,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
// Also write to disk when using devServer
|
// Also write maniafest.json to disk when running `npm run dev`.
|
||||||
// instead of only keeping manifest.json in memory
|
// This is required for Flask to work.
|
||||||
// This is required to make devServer work with flask.
|
writeToFileEmit: isDevMode && !isDevServer,
|
||||||
writeToFileEmit: isDevMode,
|
|
||||||
}),
|
|
||||||
|
|
||||||
// create fresh dist/ upon build
|
|
||||||
new CleanWebpackPlugin({
|
|
||||||
dry: false,
|
|
||||||
// required because the build directory is outside the frontend directory:
|
|
||||||
dangerouslyAllowCleanPatternsOutsideProject: true,
|
|
||||||
}),
|
}),
|
||||||
|
|
||||||
// expose mode variable to other modules
|
// expose mode variable to other modules
|
||||||
|
@ -126,9 +119,21 @@ const plugins = [
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!process.env.CI) {
|
if (!process.env.CI) {
|
||||||
plugins.push(new webpack.ProgressPlugin());
|
plugins.push(new webpack.ProgressPlugin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clean up built assets if not from dev-server
|
||||||
|
if (!isDevServer) {
|
||||||
|
plugins.push(
|
||||||
|
new CleanWebpackPlugin({
|
||||||
|
// required because the build directory is outside the frontend directory:
|
||||||
|
dangerouslyAllowCleanPatternsOutsideProject: true,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (!isDevMode) {
|
if (!isDevMode) {
|
||||||
// text loading (webpack 4+)
|
// text loading (webpack 4+)
|
||||||
plugins.push(
|
plugins.push(
|
||||||
|
|
Loading…
Reference in New Issue