Skip to content

Commit

Permalink
build: reconfigure webpack to work with modules
Browse files Browse the repository at this point in the history
Removed unnecessary entry and associated things because for now this app only needs one page and added a new rule to be able to import modules without fully specifying name, as per in this issue: facebook/create-react-app#11865 (comment).
  • Loading branch information
GrabovyiS committed Jul 31, 2024
1 parent 371ecc3 commit 383ad9f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 39 deletions.
9 changes: 0 additions & 9 deletions src/about.js

This file was deleted.

15 changes: 6 additions & 9 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import './assets/styles/reset.css';
import './assets//styles/normalize.css';
import './assets/images/placeholder.png';
import createDiv from './components/createDiv.js';
import getWeather from './data/getWeather.js';

console.log('this is index!', createDiv());
import Player from './data/Player';
import ComputerPlayer from './data/ComputerPlayer';

getWeather('moscow', 'metric').then((weatherData) => {
console.log('done');
const output = document.createElement('p');
output.textContent = weatherData.resolvedAddress;
document.querySelector('body').append(output);
});
let player = Player();
let computerPlayer = ComputerPlayer();

console.log('We are live baybe!');
13 changes: 0 additions & 13 deletions src/templates/about.html

This file was deleted.

14 changes: 6 additions & 8 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ const __dirname = path.dirname(__filename); // get the name of the directory
export default {
entry: {
index: './src/index.js',
about: './src/about.js',
},
mode: 'development',
module: {
rules: [
{
test: /\.m?js/,
resolve: {
fullySpecified: false,
},
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
Expand All @@ -32,13 +37,6 @@ export default {
template: 'src/templates/index.html',
title: 'Index html template',
filename: 'index.html',
chunks: ['index'],
}),
new HtmlWebpackPlugin({
template: 'src/templates/about.html',
title: 'About html template',
filename: 'about.html',
chunks: ['about'],
}),
],
output: {
Expand Down

0 comments on commit 383ad9f

Please sign in to comment.