You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importenvfrom'env';importConfigServicefrom'./services/config-service';import{login,authenticateUser,getCachedUser}from'./application/auth';import'../styles/styles.less';import{detectBrowser}from'./util/browser-detection';import{Aurelia}from'aurelia-framework';import{PLATFORM}from"aurelia-pal";import{bootstrap}from'aurelia-bootstrapper-webpack';import{WebpackLoader}from'aurelia-loader-webpack';require('!style-loader!css-loader!leaflet-draw/dist/leaflet.draw.css');exportfunctionconfigure(aurelia){functionstartApp(config,user){config.user=user;bootstrap(async()=>{aurelia.use.standardConfiguration().plugin('aurelia-validation');if(env.debug)aurelia.use.developmentLogging();aurelia.loader.registerLoader(WebpackLoader)awaitaurelia.start()aurelia.setRoot(PLATFORM.moduleName('/src/main.js'));})}lettestUser={userName: 'testUser@mockserver.com',profile: {}};this.browser=detectBrowser();ConfigService.getConfig().then(config=>{if(!config.testing&&this.browser.name!=='ie'){authenticateUser(config).then(user=>{if(user){startApp(config,user);}else{login(config);}}).catch(err=>console.log('Main:Error with authentication',err));}else{startApp(config,testUser);}}).catch(err=>console.log('Error with config file',err));}
My webpack.config.js looks like:
// The plugin that loads your source code in Aurelia.const{ AureliaPlugin }=require('aurelia-webpack-plugin');// This is siteActions node tool to resolve paths.constpath=require('path');// We need this to use the CommonsChunkPlugin.constwebpack=require('webpack');// The plugin that adds the script tags to our index.htmlconstHtmlWebpackPlugin=require('html-webpack-plugin');constCopyWebpackPlugin=require('copy-webpack-plugin');constENV=process.env.NODE_ENV&&process.env.NODE_ENV.toLowerCase()||'development';constproject=require('./package.json');// basic configuration:consttitle='Acuity IPS Admin';constbaseUrl='/';constrootDir=path.resolve();constsrcDir=path.resolve('src');constoutDir=path.resolve(__dirname,'dist');constbootstrap=['aurelia-bootstrapper','aurelia-bootstrapper-webpack','aurelia-polyfills','aurelia-pal','aurelia-pal-browser','regenerator-runtime','whatwg-fetch'];constvendor=['leaflet','leaflet-draw','moment','flatpickr','redux','redux-thunk','redux-logger'];constaurelia=Object.keys(project.dependencies).filter(dep=>dep.startsWith('aurelia-'));console.log(aurelia)constconfig={// Sets mode as per v4 migrationmode: ENV,devtool: 'inline-source-map',performance: {hints: false},entry: {'main': './src/main','bootstrap': bootstrap,'aurelia': aurelia,'vendor': vendor},resolve: {alias: {env: path.join(__dirname,'src/config/env-dev.js')}},output: {//This is the folder where our packed app will be after we run webpack.publicPath: '/',path: outDir,filename: 'scripts/[name].[hash].bundle.js',sourceMapFilename: 'scripts/[name].[hash].map',chunkFilename: 'scripts/[name].[id].[hash].chunk.js'},module: {// Loaders is changed to rules in v4 migrationrules: [//This loader runs babel for every js file so the files are transpiled to ES5 javascript.//NOTE: Additional Babel settings are in the .babelrc file{test: /\.js?$/,exclude: [/node_modules/,path.resolve('./**/*.spec.js')],loader: "babel-loader",options: {code: true,rootMode: 'upward',presets: ['@babel/preset-env']}},//This loader reads our html templates that are referenced and bundles them with our javascript.{test: /\.html$/,exclude: [/node_modules/,path.resolve('src/index.html')],loader: 'html-loader'},// LESS and CSS files{test: /\.css$/,exclude: /node_modules/,loader: 'style-loader!css-loader?-minimize'},{test: /\.less$/,exclude: /node_modules/,loader: "style-loader!css-loader?-minimize!less-loader"},// File loader for supporting images, for example, in CSS files.{test: /\.(png|gif|jpg|svg)$/,loader: "file-loader?name=/images/[name].[ext]"}],},// Added in wbpack v4 migrationoptimization: {splitChunks: {chunks: 'all'}},plugins: [newwebpack.ProvidePlugin({Promise: 'es6-promise-promise'}),//The Aurelia Plugin.newAureliaPlugin(),// REMOVE for v4 migration// This is what will create siteActions separate bundle for the libs under 'aurelia'// in our entry section.// new webpack.optimization.splitChunks({// name: ['bootstrap', 'aurelia', 'vendor'].reverse()// }),// This plugin will add our bundles to the html file and copy it // to the build folder.newHtmlWebpackPlugin({template: 'index.html',chunksSortMode: 'auto'}),newCopyWebpackPlugin([// Copy directory contents to {output}/to/directory///{ from: 'assets', to: 'assets' },{from: 'src/config',to: 'config'},//{from: 'web.config', to: 'web.config'}])],node: {fs: "empty"},//Development Server SettingsdevServer: {port: 8080}}//DEVELOPMENT BUILD SETTINGS//TODO: split webpack configs into development and production files?if(ENV==='development'){//Add development build specific changes}//PRODUCTION BUILD SETTINGSif(ENV==='production'){// config.devtool = 'cheap-module-source-map';//config.resolve={alias: {env: path.join(__dirname,'src/config/env-prod.js')}};//// //Add any additional PROD or QA plugins// config.plugins.push(// new webpack.optimize.UglifyJsPlugin({// minimize: true,// sourceMap: config.devtool && (config.devtool.indexOf("sourcemap") >= 0 || config.devtool.indexOf("source-map") >= 0)// })// );config.plugins.push(newCopyWebpackPlugin([{from: 'npm-dist',to: '.'}]))}module.exports=config;
Expected/desired behavior:
I would like to be able to build and run my application without the errors
The text was updated successfully, but these errors were encountered:
Also, have you made sure all the dependencies resolved properly and there's no duplicates? Maybe try clean the node_modules and delete lock file and reinstall dependencies first?
I'm submitting a bug report
major.minor.patch-pre
Please tell us about your environment:
Operating System:
Windows 10
Node Version:
16.16.0
NPM Version:
9.3.1
JSPM OR Webpack AND Version
webpack: 4.46.0
webpack-cli: 4.10.0
webpack-dev-server 3.11.3
Browser:
all
Language:
js
Current behavior:
I am in the process of updating webpack from v2 to v4 to alleviate security issues found by a blackduck scan.
when running
webpack serve
, I am getting this error:My package.json looks like this:
My main.js looks like:
My webpack.config.js looks like:
Expected/desired behavior:
I would like to be able to build and run my application without the errors
The text was updated successfully, but these errors were encountered: