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

Error while running webpack with art-template-loader. Can't resolve 'node_modules\art-template\lib\runtime.js #48

Open
nambiarsg opened this issue Apr 12, 2020 · 3 comments

Comments

@nambiarsg
Copy link

Hi,
below are my config and package.json files. When I run 'npm start' it always gives me the below error. And because of this I cannot load the HTML file. Please help

ERROR in ./index.art
Module not found: Error: Can't resolve 'node_modules\art-template\lib\runtime.js' in 'C:\Users\santhini.nambiar\Documents\nvtui\art-learn'
@ ./index.art 1:15-69
@ ./index.js
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] start: webpack --config webpack.config.js
npm ERR! Exit status 2

@nambiarsg
Copy link
Author

package.json file below

{
"name": "art-learn",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "webpack --config webpack.config.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"art-template": "^4.13.2"
},
"devDependencies": {
"art-template-loader": "^1.4.3",
"html-webpack-plugin": "^4.2.0",
"webpack": "^4.42.1",
"webpack-cli": "^3.3.11"
}
}

@nambiarsg
Copy link
Author

nambiarsg commented Apr 12, 2020

Webpack.config.js is as below

const path = require("path");
//var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
mode: "development",
devtool: "none",
entry: "./index.js",
output: {
filename: 'main.js',
path: path.resolve(__dirname,'dist'),
//library: 'template',
//libraryTarget: 'umd'
},

module: {
    rules: [{
    	//test: /\.(js|jsx)$/, exclude: /node_modules/, use: 'babel-loader'},
        
            test: /\.art$/,
            use: [{
                loader: "art-template-loader",
                options: {
                    // art-template options (if necessary)
                    // imports: require.resolve('./template-imports')
                }
            }]

    }]
}

};

@chubaicai
Copy link

在Webpack.config.js配置文件里面增加这句:resolve: { preferRelative: true };
https://webpack.docschina.org/configuration/resolve/#resolvepreferrelative

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

2 participants