Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Commit

Permalink
Minor bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dhinesh03 committed Nov 11, 2019
1 parent c25ab1c commit 48ca976
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 17 deletions.
Empty file removed .env
Empty file.
Empty file removed .env.development
Empty file.
1 change: 1 addition & 0 deletions config/environment/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BASE_URL=http://localhost.base.com
2 changes: 2 additions & 0 deletions config/environment/.env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BASE_URL=http://localhost.dev.com
BASE_URL_EXPAND=$BASE_URL/expanded
2 changes: 2 additions & 0 deletions config/environment/.env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BASE_URL=http://localhost.prod.com
BASE_URL_EXPAND=$BASE_URL/expanded
5 changes: 3 additions & 2 deletions config/webpack/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = {
bundleReportPath: resolve(__dirname, '../', '../', 'dist', 'report.html'),
entryPath: resolve(__dirname, '../', '../', 'src/index.js'),
templatePath: resolve(__dirname, '../', '../', 'src/index.html'),
envDevPath: resolve(__dirname, '../', '../', '.env.development'),
envPath: resolve(__dirname, '../', '../', '.env')
envDevPath: resolve(__dirname, '../', 'environment', '.env.development'),
envProdPath: resolve(__dirname, '../', 'environment' , '.env.production'),
envPath: resolve(__dirname, '../', 'environment' , '.env'),
};
17 changes: 6 additions & 11 deletions config/webpack/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ module.exports = [
loader: 'url-loader',
options: {
limit: fontInlineSizeLimit,
name: '[name].[ext]',
publicPath: '../fonts/',
outputPath: 'fonts/'
name: 'fonts/[name].[ext]',
}
},
{
Expand All @@ -22,7 +20,8 @@ module.exports = [
options: {
hmr: process.env.NODE_ENV === 'development',
// if hmr does not work, this is a forceful method.
reloadAll: process.env.NODE_ENV === 'development'
reloadAll: process.env.NODE_ENV === 'development',
publicPath: '../'
}
},
{
Expand Down Expand Up @@ -55,9 +54,7 @@ module.exports = [
loader: 'url-loader',
options: {
limit: imageInlineSizeLimit,
name: '[name].[hash:8].[ext]',
publicPath: '../images/',
outputPath: 'images/'
name: 'images/[name].[hash:8].[ext]',
}
}
},
Expand All @@ -72,10 +69,8 @@ module.exports = [
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url-loader',
options: {
limit: 1000,
name: '[name].[hash:8].[ext]',
publicPath: '../images/',
outputPath: 'images/'
limit: imageInlineSizeLimit,
name: 'images/[name].[hash:8].[ext]',
}
}
];
11 changes: 8 additions & 3 deletions config/webpack/webpack.development.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ module.exports = {
exclude: /node_modules/,
loader: 'eslint-loader',
options: {
cache: true,
configFile: '.eslintrc.js',
cache: false,
configFile: './.eslintrc.js',
emitWarning: true,
// Fail only on errors
failOnWarning: false,
Expand All @@ -47,7 +47,12 @@ module.exports = {
},
plugins: [
new Dotenv({
path: paths.envDevPath // Path to .env file (this is the default)
path: paths.envDevPath, // Path to .env.development file
expand: true
}),
new Dotenv({
path: paths.envPath, // Path to .env file
expand: true
}),
new MiniCssExtractPlugin({
filename: 'css/[name].css',
Expand Down
7 changes: 6 additions & 1 deletion config/webpack/webpack.production.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ module.exports = {
new webpack.HashedModuleIdsPlugin(), // so that file hashes don't change unexpectedly
new CleanWebpackPlugin(),
new Dotenv({
path: paths.envPath // Path to .env file (this is the default)
path: paths.envProdPath, // Path to .env.production file
expand: true
}),
new Dotenv({
path: paths.envPath, // Path to .env file
expand: true
}),
new MiniCssExtractPlugin({
filename: 'css/[name]-[contenthash:8].css',
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ if (process.env.NODE_ENV !== 'production') {
console.log('Looks like we are in development mode!');
}

console.log('Env var test ===>', process.env.BASE_URL, process.env.BASE_URL_EXPAND);
// Wire up mithril app to DOM
const $root = document.body.querySelector('#root');
m.route($root, DefaultRoute, Routes);

0 comments on commit 48ca976

Please sign in to comment.