Skip to content Skip to sidebar Skip to footer

Webpack: Fine On Macos, Loader Errors On Linux

I'm having some webpack/raw-loader/sass-sync-loader issues. On my local machine, things run fine. However, on my linux CI server, webpack fails. Can someone give me a pointer as to

Solution 1:

As @Richard_Boardman pointed out, Mac is not case-sensitive, but Linux is. So, any misspellings of case will work fine in your Mac dev environment, but fail when you deploy.

You can force Webpack to be more exacting with its filename and path matching in both dev server and build - so misspellings will fail while still on your dev box, rather than on the server - by using a Webpack plugin like case-sensitive-paths-webpack-plugin.

Once you have that installed, you could write some tests such as:

describe("Case-Sensitive Paths Plugin", () => {
  it('shouldn\'t interfere with correctly-spelled imports', () => {
    const getUser1 = require('../src/utils/api');
    expect(getUser1).toBeDefined();
  });

  it('should cause mistakes in filename case to fail import', () => {
    expect(() => {const getUser2 = require('../src/utils/API');}).toThrow();
  });

  it('should cause mistakes in path case to fail import', () => {
    expect(() => {const getUser3 = require('../src/Utils/api');}).toThrow();
  });
});

Post a Comment for "Webpack: Fine On Macos, Loader Errors On Linux"