Preact-cli: How to add a new loader ?

Created on 16 Jan 2018  路  4Comments  路  Source: preactjs/preact-cli

More specifically I'm trying to use the slim-lang-loader

From the examples, I found I see that it's possible to change configurations on existing loaders, but haven't yet understood how to add a new loader.

Thanks!

Most helpful comment

Might be good to add a section to the wiki addressing this.

All 4 comments

Looking at https://github.com/developit/preact-cli/blob/master/src/lib/webpack/webpack-base-config.js

and doing:

// preact.config.js
const webpack = require('webpack');

import HtmlWebpackSlimPlugin from 'html-webpack-slim-plugin';

export default function (config, env, helpers) {
    config.module.loaders.push({test: /\.slim$/, loader: ['slim-lang-loader']});
    config.resolve.extensions.push(".slim");
}

did it

Might be good to add a section to the wiki addressing this.

Looking at https://github.com/developit/preact-cli/blob/master/src/lib/webpack/webpack-base-config.js

and doing:

// preact.config.js
const webpack = require('webpack');

import HtmlWebpackSlimPlugin from 'html-webpack-slim-plugin';

export default function (config, env, helpers) {
    config.module.loaders.push({test: /\.slim$/, loader: ['slim-lang-loader']});
    config.resolve.extensions.push(".slim");
}

did it

This link is dead now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oren picture oren  路  4Comments

smjnab picture smjnab  路  3Comments

hesselbom picture hesselbom  路  3Comments

AlStar01 picture AlStar01  路  3Comments

andybons picture andybons  路  3Comments