Skip to content

Commit

Permalink
fix: #5
Browse files Browse the repository at this point in the history
  • Loading branch information
meixg committed Sep 10, 2021
1 parent 33f1eaa commit b8376d5
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 22 deletions.
7 changes: 6 additions & 1 deletion examples/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ export default {
rules: [
{
test: /\.san$/,
loader: 'san-loader',
use: {
loader: 'san-loader',
options: {
compileTemplate: 'aPack'
}
}
},
{
test: /\.svg$/,
Expand Down
67 changes: 49 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"hash-sum": "^2.0.0"
},
"peerDependencies": {
"san-ssr": ">1.0.0"
"san-ssr": ">1.0.0",
"san-loader": ">0.3.1"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": "eslint",
Expand Down Expand Up @@ -63,7 +64,7 @@
"less-loader": "^7.0.2",
"lint-staged": "^10.0.0",
"memfs": "^3.2.0",
"san-loader": "^0.2.0",
"san-loader": "^0.3.1",
"san-ssr": ">1.0.0",
"semantic-release": "^17.3.4",
"semantic-release-cli": "^5.4.2",
Expand Down
1 change: 1 addition & 0 deletions src/san-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default function (this: loader.LoaderContext, content: string) {

const pArr = [] as Array<Promise<void>>;
templateRequireCalls.map(templateRequire => {
templateRequire += '&compileTemplate=none';
this.loadModule(templateRequire, (err, source) => {
if (err) {
return pArr.push(Promise.reject(err));
Expand Down
2 changes: 1 addition & 1 deletion test/san-loader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ test('templateStore', () => {
`);

expect(mockLoadModule).toHaveBeenCalledTimes(1);
expect(mockLoadModule.mock.calls[0][0]).toBe('/path/to/foo.san?lang=html&san=&type=template');
expect(mockLoadModule.mock.calls[0][0]).toBe('/path/to/foo.san?lang=html&san=&type=template&compileTemplate=none');
});

0 comments on commit b8376d5

Please sign in to comment.