Webpack

Error while configuring CSS modules with webpack

随声附和 提交于 2021-02-19 06:02:09
问题 I am trying to configure CSS modules with webpack but I get an error. I have checked the other answers here on stackoverflow but none of the solutions have made it work for me so far. I have added the loader as the docs suggest but it still shows an error. This is my webpack.configuration.js file. const path = require('path'); const HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = { entry: './src/index.js', output: { path: path.join(__dirname, '/dist'), filename: 'index

Can I start a socket.io/websocket server in browser?

徘徊边缘 提交于 2021-02-19 05:34:00
问题 There question about this before, the answer is no. But now, with browserify/webpack, can I just write code like I would on server and it will run in browser, or is there any restriction that would make this impossible? 回答1: No, you cannot. Starting a server in a browser requires access to low level functionality that simply to does not exist in a browser. Browserify cannot add fundamental low-level features to the browser that it does not have that would require additional native code

All images in /assets folder dissapear when I build with webpack

你说的曾经没有我的故事 提交于 2021-02-19 05:30:32
问题 Until now I worked in dev enviroment , but now I arrived into prod enviroment , and I run into this issue: some important details on the project: Everything works fine when I run the project on webpack-dev-server Its a React app I costumized webpack.config myself so maybe I have some mistakes (not a create-react-app) My /assets folder has some images I have font-awesome installed I use file-loader to deal with font-awesome and all the images The problem: After I run build I loose all of the

All images in /assets folder dissapear when I build with webpack

这一生的挚爱 提交于 2021-02-19 05:30:32
问题 Until now I worked in dev enviroment , but now I arrived into prod enviroment , and I run into this issue: some important details on the project: Everything works fine when I run the project on webpack-dev-server Its a React app I costumized webpack.config myself so maybe I have some mistakes (not a create-react-app) My /assets folder has some images I have font-awesome installed I use file-loader to deal with font-awesome and all the images The problem: After I run build I loose all of the

How to make AudioWorklets work with vue-cli/webpack/babel? (getting illegal invocation error)

半腔热情 提交于 2021-02-19 05:18:46
问题 I'm trying to create a WebApp with vue-cli that uses AudioWorklets, but I'm getting a bunch of errors when trying to access any property of my AudioWorkletNode, like port or channelCount etc: TypeError: Illegal invocation at MyWorkletNode.invokeGetter After hours of googling and debugging I think it's somehow related to classes, AudioWorklet seems to only work with ES6 classes but one of vue-cli/babel/webpack does it's magic (which I don't understand where and what it does) and transpiles the

Webpack + Babel Wrong Line Numbers in Stack Trace

穿精又带淫゛_ 提交于 2021-02-19 02:42:25
问题 I'm building an application with Webpack and Babel. When the application runs into an error, it correctly lists the line number for the first error but then shows the line number for the minified code for each subsequent step. My Webpack config is as follows, const webpack = require('webpack'); const path = require('path'); module.exports = { module: { loaders: [ { loader: "babel-loader", exclude: [ /(node_modules)/, ], query: { presets: ['es2015','react'], plugins: ['transform-object-rest

Is it possible to let webpack bundle CSS without import css in my entry js?

元气小坏坏 提交于 2021-02-19 02:41:48
问题 Importing CSS file in js is webpack-specific. If I use gulp+browserify I will need browserify-css . I feel uncomfortable with writing source code that directly depends on having browserify-css or webpack(especially I am not writing React/Vue app, just vanilla js). I find some Q&A related to this, e.g. import CSS and JS files using Webpack and Can I build sass/less/css in webpack without requiring them in my JS? They suggested multiple-entry-points config (if I understand them correctly), i.e.

Webpack 4 with Less and MiniCssExtractPlugin using entries

倖福魔咒の 提交于 2021-02-19 01:35:37
问题 I have following structure for styles in my application: application - css/ - bootstrap/ - boostrap.less -> has (@import "another.less") - another.less - common/ - common.less - entries/ - bootstrap.js -> has (import style from "../bootstrap/bootstrap.less") - common.js -> has (import common from "../common/common.less") And now I need to create separate CSS-es from styles imported to entries bootstrap.js and common.js. webpack.config.js const MiniCssExtractPlugin = require("mini-css-extract

Using SCSS variables in CSS Modules

风格不统一 提交于 2021-02-18 22:33:06
问题 I've a _color.scss file which consists of 400 colors as variables. And I've like 20 components which needs this color variables in their styles. I'm using SCSS + CSS Modules to construct my styles. As of now, I'm importing this _color.scss in each and every component's style.scss . Example: component1.scss @import "color.scss"; component2.scss @import "color.scss"; component3.scss @import "color.scss"; Previously, when I was using SCSS standalone, I'll import the color.scss to my index.scss

How can I use a config file in React?

本小妞迷上赌 提交于 2021-02-18 21:00:48
问题 Let's say I have 5 jsx files and each file uses some config parameter. My index.js file imports all of these 5 jsx files. Instead of having my config data spread accross 5 files, is there a way for my jsx files to get the data from a global JS object which has loaded the data from a config file? I've seen some examples, but I've not been able to get them to work. JS6 import function | Example using webpack 回答1: Assuming ES6: config.js export const myConfig = { importantData: '', apiUrl: '', .