Refactored webpack config into common

This commit is contained in:
Rohan Sircar 2020-12-30 22:15:31 +05:30
parent 937a104615
commit f294ab7009
5 changed files with 43 additions and 31 deletions

View File

@ -39,8 +39,6 @@ libraryDependencies ++= Seq(
Compile / npmDependencies ++= Seq(
"jquery" -> "3.3.1",
"popper.js" -> "1.16.1",
// // "@popperjs/core" -> "2.6.0",
"blk-design-system" -> "1.0.2",
"bootstrap" -> "4.5.3",
"@types/chart.js" -> "2.9.11",
@ -110,6 +108,9 @@ webpackDevServerPort := 8080
webpackConfigFile in fastOptJS := Some(
baseDirectory.value / "webpack.config.dev.js"
)
webpackConfigFile in fullOptJS := Some(
baseDirectory.value / "webpack.config.prod.js"
)
// webpackConfigFile in fullOptJS := Some(
// baseDirectory.value / "webpack.config.js"
// )

25
webpack.config.common.js Normal file
View File

@ -0,0 +1,25 @@
var webpack = require('webpack');
var merge = require('webpack-merge');
var generated = require('./scalajs.webpack.config');
var Path = require('path');
var local = {
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.(ttf|eot|woff|png|glb|jpeg|jpg|mp4|jsn)$/,
use: 'file-loader'
},
{
test: /\.(eot)$/,
use: 'url-loader'
}
]
},
};
module.exports = merge(generated, local);

View File

@ -1,26 +1,10 @@
var webpack = require('webpack');
var merge = require('webpack-merge');
var generated = require('./scalajs.webpack.config');
var common = require('./webpack.config.common.js');
var Path = require('path');
const rootDir = Path.resolve(__dirname, '../../../..');
var local = {
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.(ttf|eot|woff|png|glb|jpeg|jpg|mp4|jsn)$/,
use: 'file-loader'
},
{
test: /\.(eot)$/,
use: 'url-loader'
}
]
},
devServer: {
contentBase: [
Path.resolve(__dirname, 'dev'), // fastOptJS output
@ -35,12 +19,6 @@ var local = {
ignored: ["node_modules"]
}
},
plugins: [
new webpack.ProvidePlugin({
$: 'jquery/src/jquery',
jquery: 'jquery/src/jquery'
})
]
};
module.exports = merge(generated, local);
module.exports = merge(common, local);

8
webpack.config.prod.js Normal file
View File

@ -0,0 +1,8 @@
var webpack = require('webpack');
var merge = require('webpack-merge');
var common = require('./webpack.config.common.js');
var Path = require('path');
var local = {};
module.exports = merge(common, local);

View File

@ -2942,11 +2942,6 @@ pkg-dir@^3.0.0:
dependencies:
find-up "^3.0.0"
popper.js@1.16.1:
version "1.16.1"
resolved "https://registry.yarnpkg.com/popper.js/-/popper.js-1.16.1.tgz#2a223cb3dc7b6213d740e40372be40de43e65b1b"
integrity sha512-Wb4p1J4zyFTbM+u6WuO4XstYx4Ky9Cewe4DWrel7B0w6VVICvPwdOpotjzcf6eD8TsckVnIMNONQyPIUFOUbCQ==
portfinder@^1.0.26:
version "1.0.28"
resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.28.tgz#67c4622852bd5374dd1dd900f779f53462fac778"
@ -3870,6 +3865,11 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
typescript@4:
version "4.1.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.3.tgz#519d582bd94cba0cf8934c7d8e8467e473f53bb7"
integrity sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg==
union-value@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847"