SCRIPT1002: Syntax error
File: npm.datepicker-react.8bc67c13d06c5b6ac925.3d59cc2fac81304a59be.chunk.js, Line: 423, Column: 9
420 | (console.warn(
421 | "Starting with v2.0.0-beta.1 date-fns doesn't accept strings as arguments. Please
422 | use `parseISO` to parse strings. See: https://git.io/fjule",
423 | ),
ChunkLoadError: Loading chunk npm.datepicker-react failed.
(missing: http://localhost:9090/app/npm.datepicker-react.8bc67c13d06c5b6ac925.3d59cc2fac81304a59be.chunk.js)
at Anonymous function (http://localhost:9090/app/npm.react-loadable.8bc67c13d06c5b6ac925.130dd8d8b84555ceb45a.chunk.js:53:5)
at run (http://localhost:9090/app/npm.core-js.8bc67c13d06c5b6ac925.aef2e6ba9e7f76ac2bfc.chunk.js:6372:13)
at Anonymous function (http://localhost:9090/app/npm.core-js.8bc67c13d06c5b6ac925.aef2e6ba9e7f76ac2bfc.chunk.js:6389:30)
at flush (http://localhost:9090/app/npm.core-js.8bc67c13d06c5b6ac925.aef2e6ba9e7f76ac2bfc.chunk.js:4098:9)
import { DateSingleInput } from "@datepicker-react/styled";
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const OptimizeCssAssetsPlugin = require("optimize-css-assets-webpack-plugin");
const TerserPlugin = require('terser-webpack-plugin');
const modernizr = require("modernizr");
const CopyWebpackPlugin = require('copy-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
const dotenv = require('dotenv');
const fs = require('fs'); // to check if the file exists
module.exports = (env) => {
const currentPath = path.join(__dirname);
const basePath = currentPath + '/.env';
const envPath = basePath + '.' + env.ENVIRONMENT;
const finalPath = fs.existsSync(envPath) ? envPath : basePath;
const fileEnv = dotenv.config({ path: finalPath }).parsed;
const ASSET_PATH = process.env.ASSET_PATH;
const envKeys = Object.keys(fileEnv).reduce((prev, next) => {
prev[`process.env.${next}`] = JSON.stringify(fileEnv[next]);
return prev;
}, {});
return {
context: path.resolve(__dirname, 'src/main/client'),
entry: './index',
devtool: 'cheap-module-source-map',
optimization: {
minimizer: [
new TerserPlugin({
cache: true,
parallel: true,
terserOptions: {
mangle: true,
compress: true,
ecma: 6
},
}),
new OptimizeCssAssetsPlugin({
}),
],
runtimeChunk: 'single',
splitChunks: {
chunks: 'all',
maxInitialRequests: Infinity,
minSize: 0,
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name(module) {
const packageName = module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1];
return `npm.${packageName.replace('@', '')}`;
},
},
}
}
},
plugins: [
new CompressionPlugin({
test: /\.js$|\.css$|\.html$|\.(png|svg|jpg|gif)$/,
cache: true,
filename: '[path].gz[query]',
algorithm: 'gzip',
threshold: 10240
}),
new CleanWebpackPlugin([
'./target/webapp'
]),
new HtmlWebpackPlugin({
template: './index.html',
filename: '../index.html',
xhtml: true
}),
new MiniCssExtractPlugin({
filename: "[name].[hash].css",
}),
new CopyWebpackPlugin([
{ from: '../webapp/**/*', to: '../' },
{ from: 'fragments', to: '../fragments' },
]),
new webpack.DefinePlugin( envKeys ),
new webpack.HashedModuleIdsPlugin() // so that file hashes don't change unexpectedly
],
output: {
publicPath: ASSET_PATH,
filename: '[name].[hash].js',
chunkFilename: '[name].[hash].[chunkhash].chunk.js',
path: path.resolve(__dirname, 'target/webapp/app/')
},
node: {
fs: 'empty',
net: 'empty',
tls: 'empty',
'utf-8-validate' : 'empty'
},
module: {
rules: [
{
loader: "webpack-modernizr-loader",
test: /\.modernizrrc\.js$/
},
{
test: /\.html$/,
exclude: /node_modules/,
use: { loader: 'html-loader' }
},
{
test: /\.s?css$/,
use: [
MiniCssExtractPlugin.loader,
{ loader: 'css-loader', options: { importLoaders: 1 } },
{ loader: 'postcss-loader' },
{ loader: 'sass-loader' }
]
},
{
test: /\.(png|svg|jpg|gif)$/,
use: [
'file-loader'
]
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: './assets/fonts/'
}
}
]
},
{
test: /\.(js|jsx)$/,
exclude: [/node_modules\/(?!(swiper|dom7)\/).*/, /\.test\.js(x)?$/],
loader: "babel-loader",
options: {
presets: ["@babel/env","@babel/preset-react"],
plugins: ["@babel/plugin-syntax-dynamic-import"]
}
}
],
},
resolve: {
alias: {
modernizr$: path.resolve(__dirname, "./.modernizrrc.js"),
"propertypal-shared-components": path.resolve('./node_modules/propertypal-shared-components'),
"react": path.resolve('./node_modules/react'),
"node-fetch": path.resolve('./node_modules/node-fetch'),
"styled-components": path.resolve('./node_modules/styled-components')
}
},
stats: {
children: false,
warningsFilter: warn => warn.indexOf('Conflicting order between:') > -1 // if true will ignore
},
}
}