Skip to content

Commit

Permalink
fix: resource relative path was changed by webpack
Browse files Browse the repository at this point in the history
Also, __dirname was disabled by webpack.
ref:
- webpack/webpack#1599
- https://qiita.com/_neko/items/0d6bb1a14ac25fbc577e
  • Loading branch information
yumetodo committed May 22, 2020
1 parent 9e2cb67 commit c28e8eb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -11,6 +11,7 @@
"eslint:fix": "eslint --fix . --cache",
"tools:convert_story": "node dist/tools/storyConverter.js",
"build": "webpack --mode=development",
"watch": "webpack --mode=development --watch",
"tsc": "tsc"
},
"author": "yumetodo",
Expand Down
2 changes: 1 addition & 1 deletion tools/storyConverter.ts
@@ -1,7 +1,7 @@
import * as fs from 'fs';
import * as path from 'path';
import { CaseBase, Case, ReCase, PureDatabase } from '../lib/PureDabase';
const resourcesPath = path.join(__dirname, '..', 'resources');
const resourcesPath = path.join(__dirname, '..', '..', 'resources');
const data: Case[] = JSON.parse(fs.readFileSync(path.join(resourcesPath, 'story.json'), { encoding: 'utf-8' }))['item'];
// fill missing story number
{
Expand Down
3 changes: 3 additions & 0 deletions webpack.config.js
Expand Up @@ -7,6 +7,9 @@ module.exports = {
'tools/storyConverter': './tools/storyConverter.ts',
},
target: 'node',
node: {
__dirname: false,
},
module: {
rules: [
{
Expand Down

0 comments on commit c28e8eb

Please sign in to comment.