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

Support scss absolute path resolution for url() #7937

Merged
merged 2 commits into from
Jun 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/react-scripts/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ module.exports = function (webpackEnv) {
loader: require.resolve('resolve-url-loader'),
options: {
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
root: paths.appSrc,
},
},
{
Expand Down
Empty file.
16 changes: 16 additions & 0 deletions test/fixtures/global-scss-asset-resolution/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const testSetup = require('../__shared__/test-setup');

if (testSetup.isLocal) {
// TODO: make this work locally
test('skipped locally', () => {});
} else {
test('builds in development', async () => {
const { fulfilled } = await testSetup.scripts.start({ smoke: true });
expect(fulfilled).toBe(true);
});

test('builds in production', async () => {
const { fulfilled } = await testSetup.scripts.build();
expect(fulfilled).toBe(true);
});
}
7 changes: 7 additions & 0 deletions test/fixtures/global-scss-asset-resolution/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"dependencies": {
"node-sass": "4.x",
"react": "latest",
"react-dom": "latest"
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions test/fixtures/global-scss-asset-resolution/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.scss';

ReactDOM.render(<div />, document.getElementById('root'));
5 changes: 5 additions & 0 deletions test/fixtures/global-scss-asset-resolution/src/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#root {
width: 300px;
height: 300px;
background: url(/images/logo.svg) center/cover no-repeat;
}