Webpack

NPM: Field 'browser' doesn't contain a valid alias configuration

烈酒焚心 提交于 2021-02-10 06:46:10
问题 Executing This: node .\node_modules\webpack\bin\webpack.js --config scripts/webpack.config.js --display-error-details Produces this error. I am just testing this at the moment, so application.ts just has this export class Aureus { constructor() { alert('1'); } } The webpack file looks as follows: const globule = require("globule"); const path = require("path"); const webpack = require("webpack"); const extractTextPlugin = require("extract-text-webpack-plugin"); const config = { }; const

Webpack - Include file multiple times

旧巷老猫 提交于 2021-02-10 06:38:50
问题 I want to include a file twice through two different loaders. The reasoning is I want to display code snippets in ES6 while allowing them to be run in browsers not supporting the syntax. Effectively what I would like to achieve is the below but with both loaders results being included in the output - { test: /\.(js|jsx)$/, exclude: /node_modules/, loader: "babel-loader" }, { test: /\.(js|jsx)$/, include: /app\/examples/, use: [ { loader: "file-loader", options: { regExp: /app\/examples\/([^\/

bundle web workers as integral part of npm package with single file webpack output

匆匆过客 提交于 2021-02-10 06:29:09
问题 I am writing an npm package which is a plugin for the popular library leafletjs. I am using webpack to bundle the package. I want this package to be able to spawn and destroy some web workers on command. The web worker code is part of my source files. But I want to be able to distribute my package both as an npm module, or through a cdn, meaning it must be compiled down to a singular file that can be included through an HTML header. I am using webpack to do it. So lets say I have a worker

Why React needs webpack-dev-server to run?

夙愿已清 提交于 2021-02-10 06:19:12
问题 I'm new to React and I followed Facebook's Installation (Create a New App). So every time I need to run the app, it needs to start a server. When I try to open the build version in chrome( opening HTML directly ), nothing gets displayed. Then I tried to setup React environment myself from scratch using codecademy tutorial. Here, after I build the project, I can directly open the HTML in chrome and the contents are displayed. My question is: Why webpage doesn't get displayed in the 1st method

Why React needs webpack-dev-server to run?

扶醉桌前 提交于 2021-02-10 06:18:12
问题 I'm new to React and I followed Facebook's Installation (Create a New App). So every time I need to run the app, it needs to start a server. When I try to open the build version in chrome( opening HTML directly ), nothing gets displayed. Then I tried to setup React environment myself from scratch using codecademy tutorial. Here, after I build the project, I can directly open the HTML in chrome and the contents are displayed. My question is: Why webpage doesn't get displayed in the 1st method

workbox serviceworker working everywhere except Chrome: Uncaught (in promise) DOMException

我的未来我决定 提交于 2021-02-10 04:22:11
问题 Workbox is not working on Chrome, but it works everywhere else, which is ironic since I believe this is a Google library, the error that shows is : Uncaught (in promise) DOMException : sw.js line 1 Chrome: Opera Firefox I'm using the workbox-webpack-plugin webpack.config.js const workbox = require('workbox-webpack-plugin'); module.exports = { plugins: [ new workbox.GenerateSW({ swDest: './service-worker.js', skipWaiting: true, clientsClaim: true }) ] } index.ts (entry) if ('serviceWorker' in

workbox serviceworker working everywhere except Chrome: Uncaught (in promise) DOMException

巧了我就是萌 提交于 2021-02-10 04:21:52
问题 Workbox is not working on Chrome, but it works everywhere else, which is ironic since I believe this is a Google library, the error that shows is : Uncaught (in promise) DOMException : sw.js line 1 Chrome: Opera Firefox I'm using the workbox-webpack-plugin webpack.config.js const workbox = require('workbox-webpack-plugin'); module.exports = { plugins: [ new workbox.GenerateSW({ swDest: './service-worker.js', skipWaiting: true, clientsClaim: true }) ] } index.ts (entry) if ('serviceWorker' in

Webpack - How to bundle/require all files of a folder (subfolder)

淺唱寂寞╮ 提交于 2021-02-10 03:51:13
问题 I am trying to see if there is a shorter way of running webpack bundles, and also why my loaders do not work. Here is my code: module.exports = { context: path.join(__dirname, 'dist'), entry: ['./ES6bundle.js', './jQuery.js'], output: { filename: 'bundle.js', path: path.join(__dirname, 'dist') } }; // module: { // loaders: [{ // test: /\.js?$/, // exclude: /node_modules/, // loader: 'babel-loader', // query: { // presets: ['env'] // } // }] // }; The module.exports works but when I run the

Webpack - How to bundle/require all files of a folder (subfolder)

邮差的信 提交于 2021-02-10 03:48:59
问题 I am trying to see if there is a shorter way of running webpack bundles, and also why my loaders do not work. Here is my code: module.exports = { context: path.join(__dirname, 'dist'), entry: ['./ES6bundle.js', './jQuery.js'], output: { filename: 'bundle.js', path: path.join(__dirname, 'dist') } }; // module: { // loaders: [{ // test: /\.js?$/, // exclude: /node_modules/, // loader: 'babel-loader', // query: { // presets: ['env'] // } // }] // }; The module.exports works but when I run the

Webpack React Hot Loading not working for files in sub folders

三世轮回 提交于 2021-02-10 01:26:32
问题 Webpack hot reloading is working only for the files in the specified folder 'react-frontend', but not for files in subfolders of that folder. The strange thing is that it was working before I recently reset my machine from Ubuntu to Debian. I guess npm has installed slightly different versions on this new system. Any idea? var path = require('path'); var webpack = require('webpack'); publicPath = 'http://localhost:3000/'; module.exports = { devtool: 'eval', node: { fs: 'empty' }, entry: {