Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sass-loader: Build AoT Module build failed: No input specified: provide a file name or a source string to process #1555

Closed
vincent-cm opened this issue Feb 21, 2017 · 11 comments

Comments

@vincent-cm
Copy link

[X] bug report

ERROR in .//css-loader!.//sass-loader/lib/loader.js!./config/resource-override.js
Module build failed: No input specified: provide a file name or a source string to process
@ ./src/app/components/home/xxxxxx.scss 2:21-134 (After removing this file, I got same issue for another scss)
@ ./src/app/components/home/home.ts
@ ./compiled/src/app/app.module.ngfactory.ts
@ ./src/main.browser.aot.ts

Build AoT success but on checking resources in the final process, the npm quit with this error. Now sass-loader is 6.0.0. Changed to 4.1.1 fixed the problem.

The ExtractTextPlugin may be the problem in some google search but after hiding the relative config in webpack.prod.js, the issue exits.

@Mangesh-P
Copy link

+1

@admosity
Copy link
Contributor

Can confirm that changing back to 4.1.1 fixes the problem.

@Mangesh-P
Copy link

The issue is raised on sass-loader also
webpack-contrib/sass-loader#373

@DBosley
Copy link

DBosley commented Mar 6, 2017

Adding a note here, I get this error if the scss file is empty for non AOT builds, If I add something like body {} to the file, the compilation works fine.
The error happens regardless for AOT builds.

@vincent-cm
Copy link
Author

vincent-cm commented Mar 6, 2017 via email

@DBosley
Copy link

DBosley commented Mar 6, 2017

@vincent-cm The errors I get point to the scss files referenced in the styleUrls property of the Component class decorator. When those scss files are empty, I can't even start up the webpack dev server. When I add body {} (or any styles at all) to the file, the webpack dev server compiles everything fine and it runs. But AOT does not work at all. All scss files error when building for AOT.

@DBosley
Copy link

DBosley commented Mar 6, 2017

After trying a few things out I started looking at the angular2-template-loader. I removed it from my *.ts file loaders and now my AOT build works just fine. I don't see anything affected by this change.

Removing the template loader does break builds that don't use AOT including using the webpack-dev server.

Original .ts file loader config:

{
    test: /\.ts$/,
    use: [{
            loader: '@angularclass/hmr-loader',
            options: {
                pretty: !isProd,
                prod: isProd
            }
        },
        { // MAKE SURE TO CHAIN VANILLA JS CODE, I.E. TS COMPILATION OUTPUT.
            loader: 'ng-router-loader',
            options: {
                loader: 'async-import',
                genDir: 'pkg/compiled',
                aot: AOT
            }
        },
        {
            loader: 'awesome-typescript-loader',
            options: {
                configFileName: 'tsconfig.webpack.json'
            }
        },
        {
            loader: 'angular2-template-loader'
        }
    ],
    exclude: [/\.(spec|e2e)\.ts$/]
},

new config:

{
    test: /\.ts$/,
    use: [{
            loader: '@angularclass/hmr-loader',
            options: {
                pretty: !isProd,
                prod: isProd
            }
        },
        { // MAKE SURE TO CHAIN VANILLA JS CODE, I.E. TS COMPILATION OUTPUT.
            loader: 'ng-router-loader',
            options: {
                loader: 'async-import',
                genDir: 'pkg/compiled',
                aot: AOT
            }
        },
        {
            loader: 'awesome-typescript-loader',
            options: {
                configFileName: 'tsconfig.webpack.json'
            }
        }
    ],
    exclude: [/\.(spec|e2e)\.ts$/]
},

@Daeluse
Copy link

Daeluse commented Mar 7, 2017

I've also noticed that this error only occurs on UNIX systems. My build will compile in Windows without issue, but will throw this error on a Mac or Linux Box.

@DBosley
Copy link

DBosley commented Mar 7, 2017

@Daeluse I'm on Windows and having this issue.

@Daeluse
Copy link

Daeluse commented Mar 7, 2017

@DBosley Interesting, on Windows I do get the error if the SASS file is blank, but on Mac/Linux I get the error no matter what.

@M1strall
Copy link

M1strall commented May 21, 2017

Upgrading sass-loader to 6.0.5 fixed problem for me as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants