Webpack

Webpack dev server live reload with proxy

我的未来我决定 提交于 2021-01-28 01:16:50
问题 I'm running a PHP app at localhost:8000 . I want to use webpack-dev-server to hot reload css , react and js components. Had set a proxy to http://localhost:8000 but webpack-dev-server isn't reloading the browser. Here's the webpack.config.js : var path = require( 'path' ); var autoprefixer = require( 'autoprefixer' ); module.exports = { entry: [ './src/app.js' ], output: { path: path.join( __dirname, 'dist' ), publicPath: 'http://localhost:8000', filename: 'app.js' }, module: { loaders: [ {

I cannot understand “ Module not found: Error: Can't resolve 'fs' '”

…衆ロ難τιáo~ 提交于 2021-01-27 20:06:15
问题 Having a little spare time I have tried reworking an old project of mine with new web techs that I like (Typescript, Pug and React). Everything worked fine until I tried adding pug.js into the mix with babel-plugin-transform-react-pug . No matter how much I fiddle with the configurations I can't get the build phase to work and get the following errors: ERROR in ./node_modules/uglify-js/tools/node.js Module not found: Error: Can't resolve 'fs' ERROR in ./node_modules/resolve/lib/sync.js Module

Module build failed (from ./node_modules/sass-loader/dist/cjs.js)

独自空忆成欢 提交于 2021-01-27 20:05:07
问题 I'm trying to run my angular 9 app on windows 10 but getting the following error while trying to serve it locally. Have a look at the error below: ERROR in ./src/assets/sass/pickandpay.scss (./node_modules/css-loader/dist/cjs.js??ref--13-1!./node_modules/postcss-loader/src??embedded!./node_modules/sass-loader/dist/cjs.js??ref--13-3!./src/assets/sass/pickandpay.scss) Module build failed (from ./node_modules/sass-loader/dist/cjs.js): SassError: Undefined variable: "$white-color". on line 99 of

Vue Cli 3 disabling code splitting - Can't get rid of the hash file

一世执手 提交于 2021-01-27 19:05:30
问题 I have a vue.config.js setup that works nicely and cancels the default code splitting. But It's still outputs a CSS file with a hash identical to the CSS file with the nice name. I can write a script to delete it, but I wonder if there is a way to set the file to not output the CSS file with the hash. vue.config.js: const webpack = require("webpack"); const MiniCssExtractPlugin = require("mini-css-extract-plugin"); module.exports = { outputDir: "../assets/", configureWebpack: { plugins: [ new

Webpack-dev-server emits all chunks after every change

为君一笑 提交于 2021-01-27 18:43:46
问题 I just implemented hot-reload'ing for our dev environment. My javascript is broken up into a lot of chunks. Every time I make a change to a file all of the chunks get re-submitted. I'm running webpack-dev-server. Here is an example: Hash: 83298e5f7612c91d96ee Version: webpack 1.13.1 Time: 2417ms chunk {0} static/js/music/bundle.js (bundle) 1.87 MB + 591 hidden modules chunk {1} static/js/music/1.js 609 kB {0} + 103 hidden modules chunk {2} static/js/music/2.js 179 kB {0} + 42 hidden modules

The token '&&' is not a valid statement separator in this version

谁都会走 提交于 2021-01-27 18:30:05
问题 On the way of installing Webpack on my React Project, the following problem hinders my progress: last step to configure the Webpack npm run build && node ./dist/main.js Error on Windows Power Shell / on Visual Studio Code PS C:\Users\pythonbuddha\Desktop\to_experiment\to-do-list> npm run build && node ./dist/main.js At line:1 char:15 + npm run build && node ./dist/main.js + ~~ The token '&&' is not a valid statement separator in this version. + CategoryInfo : ParserError: (:) [],

404 not found ( webpack image )

给你一囗甜甜゛ 提交于 2021-01-27 13:21:10
问题 How can I import an image using this web pack config? I get the following error in the console after I build the app using yarn build . How can I import the image to the dashboard file from the assets/public folder? (please see image). Thanks in advance. this the webpack config file. const webpack = require('webpack'); const path = require('path'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const

How can I resolve Ionic Uncaught Error: Cannot find module “.” when adding new page?

狂风中的少年 提交于 2021-01-27 13:10:57
问题 Uncaught Error: Cannot find module "." at webpackMissingModule (index.js:3) at e.code (index.js:3) at Object.<anonymous> (index.js:9) at __webpack_require__ (bootstrap ee3a374a94c4cd74e2a6:54) at Object.256 (main.ts:5) at __webpack_require__ (bootstrap ee3a374a94c4cd74e2a6:54) at Object.233 (main.js:412) at __webpack_require__ (bootstrap ee3a374a94c4cd74e2a6:54) at webpackJsonpCallback (bootstrap ee3a374a94c4cd74e2a6:25) at main.js:1 Before adding new bookmarks pages in app, the app working

Webpack / typescript require works but import doesn't

风格不统一 提交于 2021-01-27 12:42:25
问题 I'm trying to import a node_module into a TypeScript file. I'm using an adaptation of angular2-webpack-starter for my project structure. import ace from 'brace'; In one of my files gives me Cannot find module 'brace'. But var ace = require('brace'); Works fine. According to this issue I shouldn't be having any problems. My webpack config file is copied from angular2-webpack-starter. My tsconfig.json is as follows { "compilerOptions": { "target": "es5", "module": "commonjs", "removeComments":

How to 'require' an xml file (loaded by webpack) in order to read the xml contents in javascript

给你一囗甜甜゛ 提交于 2021-01-27 11:29:14
问题 I'm using webpack as the bundler for a app and using an XML file for it configuration. Currently I'm writing tests to retrieve the config from an XML file packaged by webpack. Referencing this webpack article: Loading data the piece of code I'm having trouble is this: import Data from './data.xml'; I'm my own test, I'm using the require form which is as follows: const select = require('xpath.js'); const DOMParser = require('xmldom').DOMParser const parser = new DOMParser(); const data =