Skip to content

Error load CSS, Module build failed: Unknown word (5:1) #352

@afrianjunior

Description

@afrianjunior

im trying load css with webpack, but fail to load, message error :

in ./~/css-loader!./~/style-loader!./~/css-loader!./semantic/dist/semantic.css Module build failed: Unknown word (5:1)

style-loader and css-loader 2 does not work?

but my webpack.base.conf.js :

{ test: /\.css$/, loader: 'style!css' }

What should I do? to solve these

im use vue-cli witk webpack template.

thanks before!

Activity

LeoMartinDev

LeoMartinDev commented on Oct 21, 2016

@LeoMartinDev

Same here

zhyc9de

zhyc9de commented on Oct 23, 2016

@zhyc9de

i don't know why it happened , but i found a solution
don't use css loader , just import your css file

harwinvoid

harwinvoid commented on Dec 8, 2016

@harwinvoid

Same here

harwinvoid

harwinvoid commented on Dec 8, 2016

@harwinvoid

I fixed it by remove { test: /\.css$/, loader: 'style!css' } from webpack.config.js. But i don't know why. anyone could tell me ?

yinshipeng

yinshipeng commented on Dec 8, 2016

@yinshipeng

Same here

Jacke

Jacke commented on Dec 19, 2016

@Jacke

same. webpack the most shitty software that I ever seen. It's working by magic and nobody know how to fix it

mondaychen

mondaychen commented on Jan 11, 2017

@mondaychen

I had the same issue. I think in generally this error happens when the file is compiled by the css loader for more than once. Check your config to see if there are duplicated css loaders.

andywer

andywer commented on Jan 15, 2017

@andywer

@mondaychen is right. You have probably got more than one loader config containing style-loader and css-loader. If their include/exclude properties allow an intersection (a source file might be matched by both) you might be screwed already... :-/

Guess the only fix is making sure there is no intersection.

domingohui

domingohui commented on Jan 26, 2017

@domingohui

I saw similar things here #197
But it still doesn't work for me even if I append style! or css!

rafaelboschini

rafaelboschini commented on Jan 26, 2017

@rafaelboschini

same here ):

fengyongze

fengyongze commented on Feb 27, 2017

@fengyongze

same here

michael-ciniawsky

michael-ciniawsky commented on Mar 6, 2017

@michael-ciniawsky
Member

@LeoMartinDev @zhyc9de @harwinvoid @yinshipeng @Jacke @rafaelboschini @fengyongze you guys all using VueJS ? If then please use vue-loader instead. I reopen if my assumption is false 😛

wnewstar

wnewstar commented on Jul 3, 2017

@wnewstar

@michael-ciniawsky
why need use vue-loader instead? I do it, but have some other question.

wi-ski

wi-ski commented on Aug 19, 2017

@wi-ski

how do you fix the Bs

heythanks

heythanks commented on Aug 29, 2017

@heythanks

remove this{ test: /.css$/, loader: 'style!css' } has no error,but css file can't effect this website

vikashpisces

vikashpisces commented on Aug 31, 2017

@vikashpisces

@afrianjunior It worked for me after I changed the order of loaders from require('!css-loader!style-loader!./styles.css'); to require('!style-loader!css-loader!./styles.css');

tiserge2

tiserge2 commented on Oct 5, 2017

@tiserge2

@vikashpisces thanks guys! it works fine for me after doing it as you said

codeaimh

codeaimh commented on Oct 23, 2017

@codeaimh

guys how I know if I have a duplicated loader?

ghost

ghost commented on Jan 12, 2018

@ghost

same here But I solve this shit with using loader:'css-loader!style-loader'
Blv me Don't Use 'use' instead u can use 'loader' which is the keyword of the prev version of the weback and I think it's better than 'use'
I think it's because the css and style loader are not updated ...

buddyackerman

buddyackerman commented on Mar 29, 2018

@buddyackerman

None of the above work. I'm using Angular 5 and have ejected the project from the cli so that I can modify the webpack config.

Here's the entry section:

"entry": {
  "main": [
    "./src\\main.ts"
  ],
  "polyfills": [
    "./src\\polyfills.ts"
  ],
  "styles": [
    "./src/ui-styles.js"
  ]

and here's the module definition:

{
  "test": /\.css$/,
  "loader": 'css-loader!style-loader'
}

I've also tried this:

{
  "test": /\.css$/,
  "loader": ExtractTextPlugin.extract('style-loader!css-loader')
}

They all produce the same error.

liyanana

liyanana commented on Sep 20, 2018

@liyanana

same here.how to solve??? I cant find the answer.

atreyhazelhispanic

atreyhazelhispanic commented on Oct 14, 2018

@atreyhazelhispanic

I had this same problem as well as one with scss and sass loader... By default the full npm vue app install is loading css and sass for you. I left only the rule of style-loader on the regex of css and it's perfect!

SeedyROM

SeedyROM commented on Jan 4, 2019

@SeedyROM

@atreyhazelhispanic Could you share some example code for how you solved this?

yeahhhz

yeahhhz commented on Jan 15, 2019

@yeahhhz

Try install a low version loader

TylerNGUP

TylerNGUP commented on Jun 9, 2019

@TylerNGUP

same here,因为要先加载css-loader,然后才加载style-loader,so must write like this : loader='style-loader!css-loader', after 2.0,must add 后缀,-loader。

pangjunpeng

pangjunpeng commented on Dec 29, 2020

@pangjunpeng

same here,因为要先加载css-loader,然后才加载style-loader,so must write like this : loader='style-loader!css-loader', after 2.0,must add 后缀,-loader。

oh! your english is very well👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Jacke@mondaychen@andywer@michael-ciniawsky@domingohui

        Issue actions

          Error load CSS, Module build failed: Unknown word (5:1) · Issue #352 · webpack-contrib/css-loader