Webpack

reference assets with generated style data bind

Deadly 提交于 2021-01-29 11:00:48
问题 I'm using the vue-cli 3 and want to generate background-image paths. Therefore I'm using the style data bind within an v-for-loop. the component: <template> <ul> <li v-for="(tool, index) in tools" :key="index"> <a href="#" :style="{ backgroundImage: 'url(@/assets/icons/' + tool + '.svg)' }"></a> </li> </ul> </template> <script> export default { props: { tools: Array, } } </script> The images are in this folder: src/assets/icons/xxx.svg The problem is, that the generated image path seems to be

Webpack plugins and/or strategies for AngularJS

谁说我不能喝 提交于 2021-01-29 11:00:08
问题 I have an AngularJS 1.7 project currently being built with Gulp, and I'm looking into switching it over to Webpack. After some initial poking around, I'm finding it difficult to find and load all the source files, due to the fact that it's written in a style from before CommonJS and ES6 modules. My hunch is that it's a common (but old) style of Angular, but I'm new to it so I'm not sure. The Question : Is there a Webpack plugin or tool or strategy for building Angular 1 projects? I'm hoping

Configuration for Debugging Mocha Unit Tests in Vue.js with VSCode

一个人想着一个人 提交于 2021-01-29 10:55:39
问题 I am currently facing some problems getting my tests to debug properly with VSCode in Vue.js (I am using Mocha and Webpack) The first configuration I found which got me a bit closer was this one. Configuration in .vscode/launch.json { "type": "node", "request": "launch", "name": "Unit Tests", "program": "${workspaceFolder}/node_modules/@vue/cli-service/bin/vue-cli-service.js", "args": [ "test:unit" ], "console": "integratedTerminal", "internalConsoleOptions": "neverOpen" } Now this solution

Overriding Webpack 4 Entry Point

给你一囗甜甜゛ 提交于 2021-01-29 10:19:47
问题 Here's the directory of my project: -node_modules -src -client -js -styles -views -index.js -webpack.config.js -server -.babelrc -package -package-lock -README.md -webpack.dev -webpack.prod Here's the content of my webpack.config.js const path = require('path') const webpack = require('webpack') module.exports = { mode: 'none', //entry: path.resolve(__dirname) + './src/client/index.js', module: { rules: [ { test: '/\.js$./', exclude: /node_modules/, loader: "babel-loader" } ] } } I want to

Failed to decode downloaded font on lambda production app

六眼飞鱼酱① 提交于 2021-01-29 09:59:11
问题 I am trying to deploy an angular web app to amazon lambda with the serverless module. When I run the app in local everything works fine. The problem comes up when I deploy the app to AWS. Once the app is deployed, the app is working fine but some fonts appear to be missing and do not display correctly. This are the warnings that come up in the Chrome developer console: Failed to decode downloaded font: <URL> OTS parsing error: Size of decompressed WOFF 2.0 is less than compressed size OTS

Can't install service worker of workbox-webpack-plugin in root url for React app, it's installing at localhost:8080/dist

陌路散爱 提交于 2021-01-29 09:57:29
问题 I have been following a lot of tutorials of how to install workbox-webpack-plugin but I haven't succesfully managed to install it correctly. The service worker appears to be installing but its installing in the dist folder of my app (This is my webpacks output path). I think there's nothing wrong with this but when I run my app, there are no errors but the service worker is not functioning and I notice that it is being installed at localhost:8080/dist (The output path) and even if I try to

How to minimize webpack to-string-loader css?

。_饼干妹妹 提交于 2021-01-29 09:20:26
问题 I'm using this solution: https://stackoverflow.com/a/45452306/417620. It works great, but the CSS content that is returned has comments and is not minified. module: [ rules: [ { test: /\.css$/, use: ['to-string-loader', 'css-loader'] } ] } I'm using webpack 4. I've tried to use a number of different loaders, but they seem to no longer work with webpack 4 or they only work when the CSS is exported to a file. Is there anyway to remove the CSS comments and minify the CSS that is returned? Here

Making css-loader class names hashing work for html as strings

╄→гoц情女王★ 提交于 2021-01-29 08:55:59
问题 There are some HTML chunks as strings in my JS file. For example: `<span class="${currentIndex === index ? 'right' : ''} ${get(item, 'observed') === true ? 'observed' : ''}" data-index="${index}" data-item-id="${get(item, 'id')}"> <b style="animation-duration:${get(item, 'length') === '' ? '200' : get(item, 'length')}s"></b> </span>` The SCSS files are also imported in the JS file and the bundling works perfectly. But, when I try to enable the "modules: true" option in the css-loader, the

laravel 8 instalation error - npm run dev throws error

旧时模样 提交于 2021-01-29 08:30:12
问题 I am trying to install a fresh laravel 8 project. After downloading frontend scaffolding when I try to run npm run dev it gives me an error. This problem also happens during installing jetstream in this npm run dev . I am giving error below. unkno@DESKTOP-NAP4DRR MINGW64 /c/laravel projects/example $ npm run dev > @ dev C:\laravel projects\example > npm run development > @ development C:\laravel projects\example > mix [webpack-cli] Running multiple commands at the same time is not possible

VS Code shows module not found even though WebPack build works

懵懂的女人 提交于 2021-01-29 08:18:01
问题 My VS Code says that it can't find an import even though my WebPack build still works. Here is the import... import * as tf from '@tensorflow/tfjs'; and the message from VS Code: Cannot find module '@tensorflow/tfjs'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? I have read something about path aliases which can be set up in the tsconfig.json to shorten long paths to modules. But if this is a path alias and I don't have it configured in