webpack-style-loader

Webpack2 loading and extracting LESS file

限于喜欢 提交于 2019-12-22 09:46:56
问题 I am trying to setup Webpack2 to process my LESS files and create a separate CSS from it. I keep getting an error however. I've had trouble locating Webpack2 examples outlining the process so not sure what I am missing. My Webpack config: module.exports = { entry: { 'public': [ './src/client/styles/public.js' ] }, output: { ... }, module: { { test: /.*\.less$/, loader: ExtractTextPlugin.extract({ loader: 'less-loader', fallbackLoader: 'style-loader' }) } ] }, plugins: [ new ExtractTextPlugin(

How to ensure that hot CSS loads before JS in webpack-dev-server?

只谈情不闲聊 提交于 2019-12-22 04:36:08
问题 I'm using webpack-dev-server to hot load all of my assets including CSS. Currently though, my CSS loads after the JavaScript which causes my application issues in some places that depend on layout existing. How can I ensure that the CSS loads before the JavaScript executes? I'm thinking there must be a way to do this from module , perhaps a a callback I could hook in to? Or maybe by configuring the style-loader to have priority? This is my index.js: import './styles/main.scss'; import '.

Building server part of (React) isomorphic webapp with webpack including style-loader for CSS

試著忘記壹切 提交于 2019-12-19 10:39:22
问题 I am attempting to make a React application that I am developing isomorphic. One of the known problems with doing this is that webpack loaders allow import/require of non-javascript assets such as CSS files. e.g. // ExampleComponent.jsx import Select from 'react-select'; import 'react-select/dist/react-select.css'; If building an application with Express then node will get to this import and fail because it can not process a CSS file, it is expecting javascript only (and thanks to babel

Webpack 2: WARNING in .png, .svg, .. DEPRECATED. Configure optipng's optimizationLevel option in it's own options. (optipng.optimizationLevel)

二次信任 提交于 2019-12-18 05:55:38
问题 This WARNING is printed ~20 times when running webpack - it processes and bundles just fine, but what does it mean? How do I get rid of it? Googling around provides little to no help unfortunately. Here's my webpack config: const ExtractTextPlugin = require("extract-text-webpack-plugin"); var webpack = require("webpack"); module.exports = { entry: { dashboard: './js/main.js', vendor: ["fixed-data-table","react","react-dom","jquery", "bootstrap", "vis",], }, output: { path: "../public",

Webpack 2: WARNING in .png, .svg, .. DEPRECATED. Configure optipng's optimizationLevel option in it's own options. (optipng.optimizationLevel)

老子叫甜甜 提交于 2019-12-18 05:55:16
问题 This WARNING is printed ~20 times when running webpack - it processes and bundles just fine, but what does it mean? How do I get rid of it? Googling around provides little to no help unfortunately. Here's my webpack config: const ExtractTextPlugin = require("extract-text-webpack-plugin"); var webpack = require("webpack"); module.exports = { entry: { dashboard: './js/main.js', vendor: ["fixed-data-table","react","react-dom","jquery", "bootstrap", "vis",], }, output: { path: "../public",

Webpack “OTS parsing error” loading fonts

大憨熊 提交于 2019-12-17 06:24:13
问题 My webpack config specifies that fonts should be loaded using url-loader , and when I try to view the page using Chrome I get the following error: OTS parsing error: invalid version tag Failed to decode downloaded font: [My local URL] The relevant parts of my config look like this: { module: { loaders: [ // ... { test: /\.scss$/, loaders: ['style', 'css?sourceMap', 'autoprefixer', 'sass?sourceMap'], }, { test: /images\/.*\.(png|jpg|svg|gif)$/, loader: 'url-loader?limit=10000&name="[name]-

SCSS compilation in an isomorphic React app

回眸只為那壹抹淺笑 提交于 2019-12-14 03:42:45
问题 I'm writing an isomorphic React app based on : https://github.com/choonkending/react-webpack-node Instead of css modules used in the examples I'd like to use scss though. And for some reason I'm having a really hard time getting them to work. My first step was to remove the css webpack loaders from both the server and the client configs replacing them with scss -specific loaders (as well as removing postcss ) : loaders: [ 'style-loader', 'css-loader?modules&localIdentName=[name]_[local]_[hash

Webpack@4.0.0: “Module parse failed. You may need an appropriate loader to handle this file type” - though using css-loader and style-loader

送分小仙女□ 提交于 2019-12-13 16:33:03
问题 Below is my webpack.config.js and the package.json module.exports = { entry: "./entry.js", output: { filename: "./build/js/bundle.js" }, module: { rules: [ { test: /.\js$/, use: [ { loader: 'babel-loader', options: { presets: ["es2015"] } } ] }, { test: /.\css?$/, include: __dirname + "./src/css", exclude: __dirname + "./src/js", use: [ 'style-loader', { loader: 'css-loader', options: { modules: true } } ] } ] }, plugins: [ // new UglifyJsPlugin() ] } "dependencies": { "ajv-keywords": "^3.1.0

How to include materialize-css npm package with webpack

一个人想着一个人 提交于 2019-12-13 12:52:57
问题 I'm writing a client-side app that is using Webpack, and I cannot figure out how to require the materialize-css package. I'm using Henrik Joreteg's hjs-webpack package, and with this the yeticss npm package is included by doing an import in a sass file (e.g. @import 'yeticss' ), but this doesn't work for materialize. Requiring it straight up in the code (e.g. import 'materialize-css' in a JS file) like any other package also doesn't work. 回答1: In this case, unlike with yeticss, you need to go

WEBPACK 4 help for less configuration

谁说我不能喝 提交于 2019-12-12 18:36:53
问题 I am trying to understand some trick with webpack. I explain. What i have ? My archi is like : www - css/ - folder/ - some.src.less - other.less - cssOther/ - t.src.less - subFolder/ - t.less My archi is like this. What i want to do is to just compile *.src.less and send them to dist and keep their path and name folder. My actual webpack config. First is it obligatoy needed to use a .js entry ? (i dont need it actually) I am working on it if I found something interesting i will update here