Skip to content
This repository has been archived by the owner on Jul 14, 2022. It is now read-only.

Commit

Permalink
Support for static url
Browse files Browse the repository at this point in the history
  • Loading branch information
marianoeramirez committed May 20, 2020
1 parent 4d3d249 commit f2c3031
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 4 additions & 5 deletions config/webpack/config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const webpack = require("webpack");
if (!process.env.API_URI) {
throw new Error("Environment variable API_URI not set");
}
const STATIC_URL = process.env.STATIC_URL || '/';

module.exports = ({ sourceDir, distDir }) => ({
resolve: {
Expand All @@ -26,7 +27,7 @@ module.exports = ({ sourceDir, distDir }) => ({
},
output: {
path: distDir,
publicPath: "/",
publicPath: STATIC_URL,
},
devtool: "source-map",
module: {
Expand All @@ -48,7 +49,7 @@ module.exports = ({ sourceDir, distDir }) => ({
options: {
name: "[name].[ext]",
outputPath: "fonts/",
publicPath: "/fonts/",
publicPath: STATIC_URL+"fonts/",
},
},
],
Expand All @@ -61,7 +62,7 @@ module.exports = ({ sourceDir, distDir }) => ({
options: {
name: "[name].[ext]",
outputPath: "images/",
publicPath: "/images/",
publicPath: STATIC_URL+"images/",
},
},
{
Expand Down Expand Up @@ -112,8 +113,6 @@ module.exports = ({ sourceDir, distDir }) => ({
}),
new webpack.EnvironmentPlugin({
API_URI: "http://localhost:8000/graphql/",
SENTRY_DSN: null,
SENTRY_APM: "0",
}),
],
node: {
Expand Down
6 changes: 5 additions & 1 deletion config/webpack/config.prod.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
const MiniCssExtractPlugin = require("mini-css-extract-plugin");

const STATIC_URL = process.env.STATIC_URL || '/';


module.exports = ({ sourceDir, distDir }) => ({
output: {
filename: "js/[name].[contenthash].js"
filename: "js/[name].[contenthash].js",
publicPath: STATIC_URL,
},
module: {
rules: [
Expand Down

0 comments on commit f2c3031

Please sign in to comment.