What does “publicPath” in Webpack do?

Webpack docs state that output.publicPath is: The output.path from the view of the JavaScript. Could you please elaborate on what this actually means? I use output.path and output.filename to specify where Webpack should output the result, but I’m not sure what to put in output.publicPath and whether it is required. module.exports = { output: { … Read more

where is create-react-app webpack config and files?

I create a ReactJS project with the create-react-app package and that worked well, but I cannot find webpack files and configurations. How does react-create-app work with webpack? Where are the webpack configuration files located in a default installation with create-react-app? I’m unable to find configuration files in my project’s folders. I have not created an … Read more

TypeError: this.getOptions is not a function

I am facing a weird error when I installed Bootstrap. The error is below. I tried uninstalling less-loader and installing [email protected], because I saw it online, but it did nothing. I am unsure what to do at this step. Syntax Error: TypeError: this.getOptions is not a function @ ./node_modules/vue-style-loader??ref–8-oneOf-1-0!./node_modules/css-loader/dist/cjs.js??ref–8-oneOf-1-1!./node_modules/vue-loader-v16/dist/stylePostLoader.js!./node_modules/postcss-loader/src??ref–8-oneOf-1-2!./node_modules/sass-loader/dist/cjs.js??ref–8-oneOf-1-3!./node_modules/cache-loader/dist/cjs.js??ref–0-0!./node_modules/vue-loader-v16/dist??ref–0-1!./src/App.vue?vue&type=style&index=0&id=7ba5bd90&lang=scss 4:14-419 14:3-18:5 15:22-427 @ ./src/App.vue?vue&type=style&index=0&id=7ba5bd90&lang=scss @ … Read more

How to add fonts to create-react-app based projects?

I’m using create-react-app and prefer not to eject. It’s not clear where fonts imported via @font-face and loaded locally should go. Namely, I’m loading @font-face { font-family: ‘Myriad Pro Regular’; font-style: normal; font-weight: normal; src: local(‘Myriad Pro Regular’), url(‘MYRIADPRO-REGULAR.woff’) format(‘woff’); } Any suggestions? — EDIT Including the gist to which Dan referring in his answer … Read more

babel-loader jsx SyntaxError: Unexpected token [duplicate]

This question already has answers here: Babel file is copied without being transformed (10 answers) Closed 5 years ago. I’m a beginner in React + Webpack. I found a weird error in my hello world web app. I’m using babel-loader in webpack to help me convert jsx into js, but it seems like babel can’t … Read more

How do I generate sourcemaps when using babel and webpack?

I’m new to webpack, and I need a hand in setting up to generate sourcemaps. I’m running webpack serve from the command line, which compiles successfully. But I really need sourcemaps. This is my webpack.config.js. var webpack = require(‘webpack’); module.exports = { output: { filename: ‘main.js’, publicPath: ‘/assets/’ }, cache: true, debug: true, devtool: true, … Read more

What does the @ mean inside an import path?

I’m starting out a new vue.js project so I used the vue-cli tool to scaffold out a new webpack project (i.e. vue init webpack). As I was walking through the generated files I noticed the following imports in the src/router/index.js file: import Vue from ‘vue’ import Router from ‘vue-router’ import Hello from ‘@/components/Hello’ // <- … Read more