Answer the question
In order to leave comments, you need to log in
TS2307: Cannot find module '@/../build/global_const'.?
import * as test from '@/../build/global_const'; // выдает ошибку что такого модуля нет формат файла .ts / .js
import {Component, Vue} from "vue-property-decorator";
import basic1 from '@/../src/components/Basic1.vue'; // находит компонент и выводит его как надо
@Component({
components: {
basic1,
},
})
export default class App extends Vue {
//@todo - or use lifecycle? Стоит ли тут использовать их и почему?
constructor() {
super();
console.log(test.PROD_ENV); // выводит константу
}
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
scss: 'vue-style-loader!css-loader!sass-loader', // <style lang="scss">
sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax', // <style lang="sass">
},
},
},
// {
// test: /\.js$/,
// // use: 'babel-loader',
// use: 'source-map-loader',
// exclude: /node_modules/,
// },
{
test: /\.tsx?$/,
loader: 'ts-loader',
exclude: /node_modules/,
options: {
appendTsSuffixTo: [/\.vue$/],
},
},
Answer the question
In order to leave comments, you need to log in
"baseUrl": ".",
"paths": {
"~/*": [
"./src/*"
],
"@/*": [
"./src/*"
]
}
declare module '*.vue' {
import Vue from 'vue'
export default Vue
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question